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

fix: make set_active_gateway concurrency safe #4162

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

maan2003
Copy link
Member

@maan2003 maan2003 commented Jan 29, 2024

fixes #4110

just put a lock around it for now

return error on concurrent calls

@maan2003 maan2003 requested a review from a team as a code owner January 29, 2024 10:49
@maan2003
Copy link
Member Author

i am conflicted with return Error and using lock

error might help you find concurrent calls with set_active_gateway, but lock feels more correct semantically

@elsirion
Copy link
Contributor

Why not get rid of set_active_gateway altogether?

@elsirion
Copy link
Contributor

i am conflicted with return Error and using lock

Why not auto-commit, if you want to avoid the error case? I don't think it makes sense though, just as the lock version.

In order of preference:

  • Remove the active GW concept
  • Fail on concurrent writes
  • Autocommit
  • Locking

@maan2003
Copy link
Member Author

we still have to keep active gateway in fedimint-cli because of devimint

@justinmoon
Copy link
Contributor

Relevant discussion in #3844

@elsirion elsirion requested a review from dpc January 30, 2024 08:10
Copy link
Contributor

@m1sterc001guy m1sterc001guy left a comment

Choose a reason for hiding this comment

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

Propagating the error up is IMO the best short term solution

@maan2003 maan2003 added this pull request to the merge queue Jan 31, 2024
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (df4bd8e) 58.01% compared to head (b4227a7) 58.05%.
Report is 30 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4162      +/-   ##
==========================================
+ Coverage   58.01%   58.05%   +0.03%     
==========================================
  Files         192      192              
  Lines       42990    42990              
==========================================
+ Hits        24941    24957      +16     
+ Misses      18049    18033      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 31, 2024
@maan2003 maan2003 added this pull request to the merge queue Jan 31, 2024
Merged via the queue into fedimint:master with commit ca59e57 Jan 31, 2024
20 of 21 checks passed
@maan2003 maan2003 deleted the set_act_gw_safe branch January 31, 2024 09:06
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.

set_active_gateway is not concurrency safe
4 participants