 
         if write_updates
             #@dbg("_process_updates","writing our own updates back")
-            @_write_updates_to_db(cb)  # safe to call skipping lock, since we have the lock
+            # safe to call skipping lock, since we have the lock
+            @_write_updates_to_db (err) =>
+                cb(err, true)
         else
             #@dbg("_process_updates","no further updates from us (stable)")
-            cb()
-
-        return true  # there were patches to apply
+            cb(undefined, true)
+
 
     _squash_patches: (opts) =>
         opts = defaults opts,


    poll_for_updates: (interval=INIT_POLL_INTERVAL) =>
        retry = (interval) =>
            next_interval = Math.max(INIT_POLL_INTERVAL,Math.min(MAX_POLL_INTERVAL, POLL_DECAY_RATIO*interval))
            @dbg("poll_for_updates", "waiting #{next_interval}ms...")
            setTimeout((()=>@poll_for_updates(next_interval)), interval)


                if err
                    cb(err)
                else
                    @_process_updates updates, (err, new_updates) =>
                        # ignore err, since it would be in writing back
                        cb(undefined, new_updates)

