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

Add ability to automatically delete job when retry attempts exceeded #182

Merged
merged 5 commits into from Aug 27, 2014
Merged

Add ability to automatically delete job when retry attempts exceeded #182

merged 5 commits into from Aug 27, 2014

Conversation

sgrassie
Copy link
Contributor

Updated AutomaticRetryAttribute to add the ability to automatically delete the job if the retry count is exceeded. The implementation is based off the discussion in #104.

@odinserj I can see from the diff on github that the formatting is off somewhat. If you let me know what your tabs/spaces are set to, I'll fix it up and push an update onto the branch.

TODO:

  • Fix formatting
  • Fix any other issues raised by @odinserj

Corrected this spelling mistake.
  - Added an enum, ```AttemptsExceededAction```
  - Added ```OnAttemptsExceededAction``` property
  - Added unit test to assert the ctor sets the correct default value
Extract method from ```OnStateElection```, to move the logic to schedule the job again for later into a seperate private method. This should make changing the main logic a little easier.
Fixes #104. When the retry attempt count exceedes the number of specified attempts, then the state should be transitioned to the ```DeletedState```.

Added implementation and and unit tests to verify the new behaviour.

  - Added a test to verify that when the retry attempt count is exceeded and ```OnAttemptsExceeded``` is set to ```Delete``` then the state is transitioned to the ```DeletedState```.
  - Added a test to verify that when the retry attempt count is exceeded, and ```OnAttemptsExceeded``` is set to ```Fail``` then the default behaviour of setting the state to the ```FailedState``` is performed.
  - Added a test to verify that we can specify that no automatic retries should be performed, by setting ```Attempts``` to 0, and that we can have the job automatically be deleted.
@odinserj odinserj added this to the 1.1.0 milestone Aug 27, 2014
@odinserj
Copy link
Member

@sgrassie, great job! I don't see any issues except tabs instead of spaces. Will merge after this fix. By the way, you can install http://editorconfig.org/ extension for Visual Studio to set options just for Hangfire automatically.

Fix formatting issues - spaces, not tabs!
@sgrassie
Copy link
Contributor Author

That is a handy little extension that I will definitely use in my own projects.

Hopefully that should be the formatting issues taken care of. This will also mean than any future commits I make won't suffer from the same problem 👊

odinserj added a commit that referenced this pull request Aug 27, 2014
Add ability to automatically delete job when retry attempts exceeded
@odinserj odinserj merged commit 719f916 into HangfireIO:master Aug 27, 2014
@odinserj
Copy link
Member

Great! I had the same problems when tried to work on Hangfire at my full-time job, and fully understand how it is difficult sometimes to switch between spaces/tabs.

@sgrassie sgrassie deleted the auto-delete-job-104 branch August 27, 2014 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants