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

Use transaction with optimistic lock to eliminate race #365

Merged
merged 2 commits into from Apr 25, 2023
Merged

Conversation

metachris
Copy link
Collaborator

📝 Summary

Eliminate a possible race between multiple getPayload requests (until the Redis-write completes) by using an optimistically locked transaction.

See also:


✅ I have run these commands

  • make lint
  • make test-race
  • go mod tidy
  • I have seen and agree to CONTRIBUTING.md

michaelneuder
michaelneuder previously approved these changes Apr 24, 2023
Copy link
Collaborator

@michaelneuder michaelneuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

services/api/service.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #365 (5e4bc80) into main (7c4fa2b) will increase coverage by 0.32%.
The diff coverage is 25.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #365      +/-   ##
==========================================
+ Coverage   19.37%   19.69%   +0.32%     
==========================================
  Files          20       20              
  Lines        3939     3965      +26     
==========================================
+ Hits          763      781      +18     
- Misses       3084     3091       +7     
- Partials       92       93       +1     
Flag Coverage Δ
unittests 19.69% <25.00%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
services/api/service.go 15.62% <0.00%> (-0.06%) ⬇️
datastore/redis.go 61.96% <85.71%> (+1.63%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@metachris
Copy link
Collaborator Author

metachris commented Apr 25, 2023

has been running a few days on goerli and sepolia

rolled out to Flashbots mainnet relay

@metachris metachris merged commit 1960654 into main Apr 25, 2023
2 checks passed
@metachris metachris deleted the optlock branch April 25, 2023 10:12
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

3 participants