-
Notifications
You must be signed in to change notification settings - Fork 82
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
Added WithProgressIncrements extension methods #23
base: master
Are you sure you want to change the base?
Added WithProgressIncrements extension methods #23
Conversation
…rained control over the number of transaction commits/updates being performed especially with loops > 1000 iterations, as this will result in 1000 tx commits. On low resource cloud computing instances this can lead to Hangfire not getting heartbeat response within timeout, causing jobs to be abandoned and restarted.
{ | ||
_enumerator = enumerator; | ||
_progressBar = progressBar; | ||
_count = count; | ||
_index = -1; | ||
_percentageIncrementStep = percentageIncrementStep; | ||
_segmentThreshold = (int)((_percentageIncrementStep / 100.0) * _count); |
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.
It is incorrect to pre-calc it here, as _count
may change during enumeration
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.
Good point, will add to the PR.
{ | ||
_enumerator = enumerator; | ||
_progressBar = progressBar; | ||
_count = count; | ||
_index = -1; | ||
_percentageIncrementStep = percentageIncrementStep; | ||
_segmentThreshold = (int)((_percentageIncrementStep / 100.0) * _count); |
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.
It is incorrect to pre-calc it here, as _count
may change during enumeration
...to allow more course grained control over the number of transaction commits/updates being performed especially with loops > 1000 iterations, as this will result in 1000 (100/0.1 percentage steps) tx commits. On low resource (1 core, SQL Express) cloud computing instances this can lead to Hangfire not getting the heartbeat response within timeout, causing jobs to be abandoned and restarted.