-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
replace setInterval with a setTimeout #174
replace setInterval with a setTimeout #174
Conversation
At the moment the only missing part is the implementation of the unit tests for this fix. |
I would just use a mock to verify this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it needs to document the usage of setTimeout
.
It is not truly identical to setInterval
and the user need to know that the interval
is not guarantee to be run in exact same rate when system is under pressure / long running process.
The choice is based on we do not want to add more pressure to the system.
I think here also worth this changes.
Lines 85 to 86 in a0c3b20
externalHealthCheckTimer = setInterval(doCheck, healthCheckInterval) | |
externalHealthCheckTimer.unref() |
I addressed the requested changes @climba03003 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I switched this PR into a Draft PR because some analysis on the issue are still in progress. |
Replace the externalHealthCheckTimer with setTimeout and renamed some methods
Added the additional information section in the README file in order to explain why setTimeout has replaced setInterval
70a6072
to
d730b91
Compare
d730b91
to
b891000
Compare
b891000
to
91590db
Compare
}) | ||
|
||
fastify.get('/', (req, rep) => rep.send('A')) | ||
test('interval reentrance', async t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only real change in this file, a new test being added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Can we merge master into this PR, let the pipeline run and then if it passes, squash merge, please? |
What does this mean? |
I just did this in my repo to check if it really merges correct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If we have these concerns, we should consider enabling the setting in repos which require PR branches to be up to date with the base branch of a PR |
I was just worried in this case, as I modified the tests few days heavily. No worries. |
This PR fixes #164 replacing the setInterval timer with setTimeout.
Checklist
npm run test
andnpm run benchmark
and the Code of conduct