-
Notifications
You must be signed in to change notification settings - Fork 15
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
Remove async go-routine for dispatchAction as unnecessary (and missing returns) #573
Conversation
… edge cases) Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
7dd6888
to
4252f2a
Compare
Related issue found in the test, we're holding a lock through a long retry loop:
paladin/core/go/internal/publictxmgr/transaction_manager_loop.go Lines 130 to 143 in 10eb9e7
Which is causing a race condition with a test:
|
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Addressed the above by splitting the poll loop into two locked sections, with an unlocked section in the middle while we call the DB. |
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
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.
LGTM
core/go/build.gradle
Outdated
@@ -31,7 +31,7 @@ ext { | |||
include "mocks/**/*.go" | |||
} | |||
|
|||
targetCoverage = 94.0 | |||
targetCoverage = 93.5 |
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.
Update coverage (no drop in PR)
it's not clear why this coverage drop is needed if there is no coverage drop caused by this PR
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.
is the coverage drop needed?
I initially thought it's because the branch is not synced with main
, but it seems main
still has 94.0 as the coverage threshold
the changes themselves look good to me, thanks for simplifying the logic and avoid locking when it's unnecessary. |
I don't think I have a coverage drop in the code. I took a file from <100% coverage, to 100% coverage in this change. I only changed one file. However, I did find that I was receiving 93.9 coverage when running the build. |
So reducing the test coverage threshold to 93.5 was an intentional change.
I think that's probably caused by you've reduced the lines of code in this PR 💪 , can we update the threshold to 93.9% other than 0.4% lower? |
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Fixed #572
This code evolved over time (and multiple codebases) from some code that needed to wait for an async thread to process a piece of work, which might timeout.
This lead to dispatching the work to a background go-routine, and having a foreground context timeout. Using a go channel between the two. However, that code had missing cases that means it had potential for failing to notify the channel - particularly I spotted this line where if
pending == nil
we'd fail to put anything on the channel:paladin/core/go/internal/publictxmgr/dispatch_action.go
Line 93 in 10eb9e7
This PR proposes just simplifying it all to a synchronous function, as I cannot find any path on which there is actually an asynchronous processing function any more.