Can I do an automatic pause in node js?

45 views
Skip to first unread message

Athira G

unread,
Oct 20, 2017, 8:34:23 PM10/20/17
to nodejs
Hi,

When I am uploading multiple files. If the network down or gone can I trigger this  using node js. Then do a pause for my current task and start again once the network is back.

DaneiL

unread,
Oct 21, 2017, 4:20:13 PM10/21/17
to nod...@googlegroups.com
Are u using interprocess communication? or you are talking about upload with web browser?

On 20 October 2017 at 08:18, Athira G <aath...@gmail.com> wrote:
Hi,

When I am uploading multiple files. If the network down or gone can I trigger this  using node js. Then do a pause for my current task and start again once the network is back.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/d3467ba3-e07b-48ea-83c1-7f49bb0342ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
[]'s

johnny somethingerman

unread,
Oct 21, 2017, 4:20:15 PM10/21/17
to nodejs
Depending on the upload library you’re using you could detect when connection failure occurs (assuming we’re talking about a TCP stream like HTTP upload or similar) if the underlying socket exceptions are being exposed, you could handle them by triggering some form of network testing loop. This would be an asynchronous function that does testing of connectivity to the upload endpoint, and falls in to a setTimout or similar if the connection fails and then repeats the whole proces again. In this asynchronous function your continuation would be the upload function which you would call after the connection test succeeds.

This is a totally-off-the-top-of-my-head solution and I believe there has to be at least one if not many non modules out there that implements exactly this functionality I described. Hopefully someone else will respond to this with one of those modules as a suggestion, or maybe you’ll be able to find it yourself before resorting to attempting to roll your own... it’s a common pattern when dealing with network operations.

kallem suresh

unread,
Dec 25, 2017, 11:30:22 AM12/25/17
to nodejs
use message queuing system...
Reply all
Reply to author
Forward
0 new messages