revington opened a new issue, #341: URL: https://github.com/apache/couchdb-nano/issues/341
## Expected Behavior I should be able to cancel replication without triggering multipleResolves. Or at least this is what I think because according with node.js docs this could be a bug or not. > This is useful for tracking potential errors in an application while using the Promise constructor, as multiple resolutions are silently swallowed. However, the occurrence of this event does not necessarily indicate an error. > > -- https://nodejs.org/docs/latest/api/process.html#event-multipleresolves ## Current Behavior Everytime I cancel a replication I trigger a couple of rejects. ## Possible Solution Not sure because this might be more of an axios issue. But using an abort controller might be a solution. ## Steps to Reproduce (for bugs) ```javascript 'use strict'; require('dotenv').config(); const couchdb = require('nano')(process.env.COUCHDB); process.on('multipleResolves', function multipleResolvesHandler (type, promise, reason) { console.error('multiple resolve', { type, promise, reason }); setImmediate(() => process.exit(1)); }); let reader = couchdb.changesReader.start({ includeDocs: true , batchSize: 25 , since: 0 }); reader.on('end', function () { console.log('done'); }); couchdb.changesReader.stop(); // triggers an error reader.once('batch', function onBatch (batch) { console.log('got batch', !!batch); couchdb.changesReader.stop(); }); ``` ## Context I can not tell if I'm having an error I should care or not. ## Your Environment * nano 10.1.3 * couchdb 3.1 * node 16.15.1 (linux) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
