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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: cache process.env value to increase performance #1238

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

RomainLanz
Copy link
Member

Hey! 馃憢

This PR add a utility to retrieve the NODE_ENV & APP_KEY value from process.env.
This is usefull since accessing process.env has a huge cost in term of performance.

I'm also refactoring some HealthCheck functions and the ExceptionHandler to inject those value instead of refering them directly. This help us to create test and also remove possible side-effect.

@thetutlage
Copy link
Member

This is nice. How about also improving the Env provider?

  • We can keep the env values inside in-memory cache vs reading it everytime from the process.env.
  • Also expose another method called env.clearCache(), which clears the in-memory cache

@RomainLanz
Copy link
Member Author

Yes, we can make those changes to the Env provider.
We also need to check other modules if they directly access process.env!

@thetutlage thetutlage merged commit 291399a into develop Jun 10, 2020
@RomainLanz RomainLanz deleted the feat/cache-env-values branch June 10, 2020 14:14
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.

None yet

2 participants