andreialecu / node-apn-http2

Communicate with Apple Push Notification Service via native Node.js v8.8.1+ HTTP2 module (node-apn drop-in)
MIT License
26 stars 10 forks source link

add error handler for session #9

Closed warthog618 closed 2 years ago

warthog618 commented 5 years ago

Since the addition of the error handler my app hasn't crashed for over a month, where previously it was crashing from an unhandled error:

2018-10-20T17:05:55.807001175Z       throw er; // Unhandled 'error' event
2018-10-20T17:05:55.807007024Z       ^
2018-10-20T17:05:55.807011249Z 
2018-10-20T17:05:55.807015403Z Error: read ETIMEDOUT
2018-10-20T17:05:55.807019232Z     at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
2018-10-20T17:05:55.807023057Z 
2018-10-20T17:05:55.807026222Z Emitted 'error' event at:
2018-10-20T17:05:55.807029497Z     at emitClose (internal/http2/core.js:818:10)
2018-10-20T17:05:55.807032856Z     at process._tickCallback (internal/process/next_tick.js:63:19)
2018-10-20T17:05:55.807036319Z

As per the code comment, I'm unsure about the session lifecycle, so I'd appreciate any feedback as to whether it may be necessary to take further action to clean up the session in the handler.