Hi!
When I am opening a connection for a change stream do I really have to set a timeout for it?
why do the latest tutorials suggest setting a timeout as some kind of best practice?
see: function closeChangeStream(timeInMs = 60000, changeStream)
Hi!
When I am opening a connection for a change stream do I really have to set a timeout for it?
why do the latest tutorials suggest setting a timeout as some kind of best practice?
see: function closeChangeStream(timeInMs = 60000, changeStream)
Hi @Shay_I ,
Having a no timeout operations in programming is generally a bad habit. You need to secure your code with good resume operations and code to cover failure. Therefore indefent operations are not advised.
Thanks
Pavel
I think I’ve got to a good balance with not setting timeout:
I use node.js stream API and the method pipeline
helps to identify reading or writing errors, once the pipeline is close/exhausted/has error the pipeline command continue to the next line, then I rerun the pipeline or in case of an error it’s shuts off the health check API which causes k8s in this case to restart.
sometimes the errors comes in case of primary switch so after few seconds the service stabilize again