                 @merge.putDoc doc, callback
 
     # Keep track of the sequence number and log errors
+    # TODO test pending counts
     changed: (change) =>
+        @pending++
         (err) =>
+            @pending--
             if err
                 log.error err
                 log.debug change

        delete doc.name
        delete doc.binary
        delete doc.clearance
        if @merge.invalidId doc
            log.error "Invalid id"
            log.error doc

                callback err

    # Listen to the Couchdb changes feed for files and folders updates
    # TODO add integration tests
    # TODO use a view instead of a filter
    listenToChanges: (options, callback) =>
        @pouch.getRemoteSeq (err, seq) =>
            return callback err if err
