feat(chord): ErrorCallback to handle Group failures#605
Open
ggodik wants to merge 16 commits intoRichardKnop:masterfrom
Open
feat(chord): ErrorCallback to handle Group failures#605ggodik wants to merge 16 commits intoRichardKnop:masterfrom
ggodik wants to merge 16 commits intoRichardKnop:masterfrom
Conversation
added 11 commits
October 5, 2020 23:09
* unit tests for processChord + interfaces + mockery * suite + successChord test * handle cases where chords are not present * logic fixes for signature/chord * amqp test
Author
|
cc @zeroshade |
Codecov Report
@@ Coverage Diff @@
## master #605 +/- ##
==========================================
- Coverage 40.86% 39.05% -1.81%
==========================================
Files 34 32 -2
Lines 2763 2929 +166
==========================================
+ Hits 1129 1144 +15
- Misses 1490 1641 +151
Partials 144 144
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A chord is a Group and a task that executes when the Group is done with the results of the group.
If a task fails in that group - nothing gets called at the end of the group execution.
Proposal:
NewChordWithErrorwhich would make aChord(Group, SuccessTask, FailureTask)using the following logic:The FailureTask would take an aggregate of errors of all the failed tasks e.g.
func FailureTask(errs []string) errorAny successful completions of the tasks in the group would be 'dropped'
Changes in this PR
tasks.NewChordWithError()function that takes an additionalSignaturetasks.NewChordmaintains backwards compatiblityresults.AsyncChordResultbehavior modified to fetch ErrorCallback results if one of the tasks failsworker.gomodifications for processingErrorChordprocessChordServerandWorkerNote: Unit tests made this a larger change as they required making interfaces out of Server and Worker and injecting those into processing functions. I'd love to take this effort further - but I wanted to keep this change as small as possible. It's already 16 files so I somewhat failed at that.
Let me know if you have thoughts on the utility of the change, etc