skiqh / couchdb-global-changes

Event emitter for _changes to _all_dbs of a couchdb instance, including newly added dbs
GNU General Public License v2.0
8 stars 3 forks source link

BUG: State file sets "seq": 0 for empty databases and reprocesses the same changes again and again #6

Open kripper opened 3 years ago

kripper commented 3 years ago

How to reproduce:

1) If you run the script, you will notice a message saying:

processed all documents in the database test (up to update-sequence 0)

2) Now, If you stop and re-run the script, you will see new messages like:

processed all documents in the database test (up to update-sequence 0)
document changed: test / 845e63b0fe6c5350e387796e4341b231 {
  _id: '845e63b0fe6c5350e387796e4341b231',
  _rev: '3-f809f1a58d3bdd88f312d6abc948d5ca',
  _deleted: true
}
document changed: test / c459ecc98089c7c5a3e37d1945030bc8 {
  _id: 'c459ecc98089c7c5a3e37d1945030bc8',
  _rev: '13-1f6184ecfc0c2f0b5eaca514021b2d1e',
  _deleted: true
}
processed all documents in the database test (up to update-sequence 17-g1AAAAC0eJzLYWBgYMpgTmGQSc4vTc5ISXIoTizO1TXUy8xNLCnKz8us0EvOz80BqUpkSKr___9_VgZzIkMuUIA9KcXU0MzELIWBszQvJTUtMy81hTiT8liAJEMDkPoPNVAQbKCpoYFpmkkyASOyAIZROKI)

(I added doc details)

3) If you stop and re-run, you will get again:

processed all documents in the database test (up to update-sequence 0)

Conclusion: There is some bug probably realted with empty databases. I guess 'seq' should not be set to 0.

skiqh commented 2 years ago

Hey @kripper, thank you very much for the time and effort you put into your investigations, comments and pull requests. I haven't touched this repo in ages, so bear with me as I process your input.

It seems to me that the project in general needs significant updating — the request module has been deprecated, iriscouch's follow hasn't been updated in years, and npm audit reports heavy vulnerabilities. Sadly, I cannot promise anything, since I don't have a need for this project right now and the work required looks quite extensive :/