Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dereference timers in node.js so that the process may exit when finished #139

Merged
merged 1 commit into from
May 17, 2024

Conversation

danthegoodman
Copy link
Contributor

Using the package in a node script is preventing the process from exiting because the reload interval timer has not been marked with unref. This PR resolves that issue.

For testing, I removed the --exit flag that had been previously been forcing mocha to exit immediately even if timers or servers were still open. This also required all servers and timers to in tests to be unrefed as well.

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

})
setTimeout(() => reject(new Error('timeout')), 1500).unref()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this line so that it behaves as a proper timeout check against the backend.read call.

@danthegoodman
Copy link
Contributor Author

I didn't update the i18nextHttpBackend.js and ….min.js files because there were more changes in the files than just my targeted changes. I believe this is because the package-lock.json isn't in the repo, which means the babel/browserify packages have probably drifted slightly from the last run.

@adrai adrai merged commit f44ad1d into i18next:master May 17, 2024
2 checks passed
@adrai
Copy link
Member

adrai commented May 17, 2024

thank you, it's included in v2.5.2

@danthegoodman
Copy link
Contributor Author

wow! So quick! Thank you 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants