Giter Club home page Giter Club logo

Comments (7)

flipace avatar flipace commented on May 30, 2024 7

When will #55 be merged and released?

from node-pushnotifications.

alex-friedl avatar alex-friedl commented on May 30, 2024 1

Hi @sbat,
from the issue you referenced it looks like it's an open issue with node-apn?

from node-pushnotifications.

dertieran avatar dertieran commented on May 30, 2024

I think this happens because you always create a new connection and never close it.
From the node-apn readme:

You should only create one Provider per-process for each certificate/key pair you have. You do not need to create a new Provider for each notification. If you are only sending notifications to one app then there is no need for more than one Provider.

If you are constantly creating Provider instances in your app, make sure to call Provider.shutdown() when you are done with each provider to release its resources and memory.

So something like this would help:

const connection = new apn.Provider(settings.apn);
return connection.send(message, regIds)
  .then((response) => {
    /* ... */
    connection.shutdown();
    return resumed;
  })
  .catch((error) => {
    connection.shutdown();
    throw error;
  })

But as mentioned in #47 it would be better to reuse the connection and offer a push.shutdown() or something like this.

from node-pushnotifications.

heyjared avatar heyjared commented on May 30, 2024

Is there a way to manually shutdown the connection to the provider?

from node-pushnotifications.

jpike88 avatar jpike88 commented on May 30, 2024

Looks like the pull request doesn't really fix the issue apparently. Do yourself a favour everyone and update to Node 8.8.1+... I have released a package that eliminates the memory leak issue.

https://github.com/streaka/node-pushnotifications-http2

from node-pushnotifications.

alex-friedl avatar alex-friedl commented on May 30, 2024

Merging #55 as a quick fix for the memory leak issue.
Will look into changing the implementation to only use one Provider instance, if feasible.

from node-pushnotifications.

alex-friedl avatar alex-friedl commented on May 30, 2024

Fixed after merge of #55

from node-pushnotifications.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.