MatthieuLemoine / push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
198 stars 75 forks source link

High CPU due to socket retry #3

Closed PedroKantar closed 6 years ago

PedroKantar commented 6 years ago

@MatthieuLemoine

I Have followed your advice and implement a decreasing delay between re-connection attempts. I tested the code (connected, not connected, connected) and it works OK. I set up the max delay (RETRY_MAX_TEMPO) to 15 seconds.

Feel free to update it if it does not fit your original approach.

MatthieuLemoine commented 6 years ago

Thanks a lot @PedroKantar.

It's great ! I just made some modifications so that we don't have to use a global retryCount. Can you review it and test it again ?

PedroKantar commented 6 years ago

Hi, modifications look OK to me, I'm testing it..

PedroKantar commented 6 years ago

It is OK, I tested the modification and it works. Thanks!

MatthieuLemoine commented 6 years ago

Merged ! Thanks for this PR !

PedroKantar commented 6 years ago

👍

MatthieuLemoine commented 6 years ago

Released in v1.1.2