jcrugzz / changes-stream Goto Github PK
View Code? Open in Web Editor NEWA fault tolerant changes stream for couchdb
A fault tolerant changes stream for couchdb
I have created a PR (#23) to reduce delay with parsing large documents.
The current approach splits the entire document buffer after every append.
The new approach splits each new chunk before it is appended.
This takes document parse time from quadratic time down to linear.
There are situations where folks proxy the CouchDB API or otherwise only expose parts of it--such as the changes feed--into their own API space. Since this library only (afaict) works with the changes feed directly and doesn't access other database bits, it'd be helpful if I could pass in the URL directly to the feed itself.
@sballesteros can speak more to this use case. ๐
Since node v10, ReadableStream
s are async-iterable, i.e. one can do the following:
for await (const chunk of readable) {
data += chunk;
}
See the docs for more details.
It would be very convenient to be able to iterate through changes this way:
const ChangesStream = require('changes-stream');
const changes = new ChangesStream({ db: '...' });
for await (const change of changes) {
...
}
Hi there,
How can I wrap stream errors with user facing error messages for instance when couch responds with something else than a 200
? (specifically in my case when a filter doesn't exist on a design document).
Cheers!
Jun
I'm using your library to open a stream to npm's CouchDB's replication stream and want to temporarily pause the stream. When pausing there is a massive memory leak.
I check the heap size every 2.5 seconds.
Program is using 51262680 bytes of Heap.
Program is using 87967800 bytes of Heap.
Program is using 118294960 bytes of Heap.
Program is using 150143144 bytes of Heap.
Program is using 183234064 bytes of Heap.
Program is using 216274768 bytes of Heap.
๐ i am just saying hi and that i ported this to Rust in case ya'll were interested. thanks for a cool package! https://github.com/ashleygwilliams/changes-stream-rust
hi,
what's the best practice for a graceful shut down?
im piping it to other stream handlers
Having running watcher for a while I've got such errors in logs:
Error: socket hang up
at createHangUpError (_http_client.js:323:15)
at Socket.socketCloseListener (_http_client.js:364:25)
at Socket.emit (events.js:194:15)
at TCP._handle.close (net.js:597:12) code: 'ECONNRESET'
Config is totally similar to one from docs.
Any ideas to investigate, perhaps?
The HTTP option Reject Unauthorized is always set to true
regardless of values set for options strictSSL
and rejectUnauthorized
due to following code snippet:
this.rejectUnauthorized = options.strictSSL || options.rejectUnauthorized || true;
This turns out to be a problem for npm Enterprise (npm/policy-follower) that depends on changes-stream package when using an SSL interceptor even Reject Unauthorized option for npm Enterprise is set to false
:
changes-stream error: self signed certificate in certificate chain
I get the following errors after leaving a connection open for a few hours.
[tracker - 27229]: { Error: CouchDB disconnected gracefully
[tracker - 27229]: at ChangesStream._onEnd (./node_modules/changes-stream/index.js:297:13)
[tracker - 27229]: at emitNone (events.js:91:20)
[tracker - 27229]: at IncomingMessage.emit (events.js:185:7)
[tracker - 27229]: at endReadableNT (_stream_readable.js:974:12)
[tracker - 27229]: at _combinedTickCallback (internal/process/next_tick.js:74:11)
[tracker - 27229]: at process._tickDomainCallback (internal/process/next_tick.js:122:9)
It then seems that the stream maybe isn't really closed but it would be nice to either mention this in the error message (alongside with some info about the stream which would also be solved with #16).
The last published version v2.2.0 was pushed three years ago, 30/11/2016 - https://www.npmjs.com/package/changes-stream
However, you have merged other changes since, more specifically the one where you upgraded packages - cbfd7d6 and debug moved from ~0.8.0 to ~3.1.0.
If you could bump up the version number and push the package again, it would help remove security warnings from the apps who are using this package.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.