-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix: improve assets discovery worker stability. #597
Conversation
It now does not allow to have parallel update process of the same assets. It ensures timeouts for all the async processes to avoid long or never ending requests to db or HTTPs. It ensures that even if one entity process is failed - others will be successfully updated.
|
||
private async iteration() { | ||
return startBackgroundTransaction(this.tableName, AssetsDiscovery.constructor.name, async () => { | ||
const now = Math.floor(Date.now() / 1000); |
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 still beleive that enire logic should be changed in order to take in a count
all the previous responses time/timeouts in updatedTime parameter.
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.
Noted
Coverage ReportIlc/serverCommit SHA:b9117f1af173eeadb3d10be1f76e049048f2e439 Test coverage results 🧪
File details
Ilc/clientCommit SHA:b9117f1af173eeadb3d10be1f76e049048f2e439 Test coverage results 🧪
File details
RegistryCommit SHA:b9117f1af173eeadb3d10be1f76e049048f2e439 Test coverage results 🧪
File details
|
() => | ||
this.iteration().catch((err) => { | ||
const runLoop = () => { | ||
this.timerId = setTimeout(async () => { |
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.
what is the idea behind adding recursion instead of setInterval ?
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.
setInterval can run processes in paralell, because if process takes more time than interval - interval won't wait completion before next interval is started, that is why it can lead to sum resources for all parallel processes
It now does not allow to have parallel update process of the same assets.
It ensures timeouts for all the async processes to avoid long or never ending requests to db or HTTPs.
It ensures that even if one entity process is failed - others will be successfully updated.