Fixes Issue #543 - Provider does not shutdown when told#551
Fixes Issue #543 - Provider does not shutdown when told#551DJHoltkamp wants to merge 7 commits intonode-apn:mainfrom
Conversation
|
I have noted an extra issue I found when using this library. I think it might have cropped up due to me getting rid of the timer at the correct time. In our aws lambda function, we shutdown the connection a lot and then it gets re-opened. Lambda also keeps the function alive between calls many times. Somehow in this environment, we frequently have our code execute as follows: Where "started send" shows, but then lambda stops the function before "send finished" without any function error, signifying that there were no more threads/processes running. I am not really up to speed on sockets with Node.js so I am not sure how to go about debugging it. I only mention it here because it could be related to this fix. Before, the heartbeat timer would cause it to continue on, but also, as my issue says incorrectly keeps the function around for another minute. |
|
Ok, so I drilled down in the code a bit further. My ES6 promise knowledge is no where near good, but here is a possible issue in client.js You'll notice here, it seems to just push this into the queue and not resolve anything. In my case, where the promise is not being met, would this not cause there to be 0 processes running, hence my termination from lambda? Not sure who was supposed to send this "Wakeup" call, but if it was the heartbeat timer, then you are kind of screwed if you already shutdown() even once like I have. Thoughts? |
|
@DJHoltkamp I ran into the same issue and think I fixed it in #554. What do you think? |
|
I'd have to try it out in production, but it looks like it may fix it. |
When used locally or on AWS Lambda, the provider holds the process running with the heartbeat timer. This turns off the timer on close