Handling closed and broken connection

Hi all!

Can someone share an idea of the right way of making the worker to wait
for some event to happen without blocking other requests (eg. for some
file to appear on the local filesystem)?

I tried setting up the timers but not sure it is a proper way, though it
is working. The ‘destroyed’ flag is being set while connection is
actually open and I have to figure out how to handle the closed
connection event to stop the timers.


Also, maybe someone can recommend some existing module which implements
familiar logic of keeping the connection open without blocking and
waiting for some event to happen before sending out the file?