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

Added WithProgressIncrements extension methods #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wimdows-nl
Copy link

@wimdows-nl wimdows-nl commented Feb 28, 2017

...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.

…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);
Copy link
Owner

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

Copy link
Author

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);
Copy link
Owner

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

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