-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout #5
Comments
Hi oiime! This proyect is active and i'll be glad to help you, in this case, it will be quick! The library already has the functionality you are looking for, check out the method called Sock#setTimeout(timeout) in http://alemures.github.io/fast-tcp/Sock.html Sock is the super class of client and server sockets so, it will be available for you to use in either side. |
Hey, thanks for the prompt response. that setTimeout as far as I understood is to add a timeout to the socket itself. my intention is adding a TTL to a call to allow releasing of hanging callbacks, ideally it'll be passed as an argument to the cb. eg:
then if a
this is however problematic as the message would still be sent as it is already in the queue (either in the socket level or in the library queue). I guess that could be somewhat worked around if using ttl requires using the library's queue and the queue checks and releases |
Hi @oiime , after a while since our last conversation, i think i have a good solution for your suggestion. socket.emit('theevent', 'thedata', { timeout: 50 }, (result) => {
console.log(result);
}); Few things to add about my actual solution:
Any feedback is welcome =) |
About the second point, i just decided to go for the two parameters option, the ack callback will always be called with (err, data). |
Hello, I can wrap what i am asking, so feel free to decline if bothering. I tested callback on emit on rooms, (if my tests are correct, may be i am wrong, sorry if it is the case) it seems not to work, and it is normal, because there might be multiple members. This is the point, callbacks could work on rooms, if the caller accept all answers within the timeout, and when the timeout is reached, a last callback is launch with error = 'close' or something like that. It could be usefull, to synchronise things between members. elect master for clustering processes/servers when a process/server is down ... PS: Your module is really great, sincerely, thank you. I will do benchmarks, but i am sure it is a good challenger to NATS. |
Hey, sorry for the late response, I definitely agree that (err, result) is the correct format, it's an almost universal standard at this point. I think that the nature of the error should denote what state it "timeouted" in, there could be a big difference in application behavior to a timeout in queue and a timeout waiting for server response, they are inheritly different errors. Thanks |
Hey, I noticed the project is not being actively maintained recently so I'm not sure you're reading this, How would you go about adding a TTL feature to the protocol? I'm thinking of adding it myself and was wondering what would be the best way. The purpose is to trigger an error after emit if a given number of ms has passed. I can implement this by wrapping the response without a setTimeout but the message would still exist in the queue and pass on to the server
The text was updated successfully, but these errors were encountered: