-
-
Notifications
You must be signed in to change notification settings - Fork 131
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/ issue #164: Race condition in init() of connector classes #197
Merged
Conversation
This file contains 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
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
Signed-off-by: OjusWiZard <[email protected]>
nikspz
approved these changes
Sep 6, 2023
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.
Test performed:
- Cloned and installed fix branch PR197 + latest development
- Connected uniswap arbitrum and created amm_arb using it
- started strategy, review bot showed profitability rate
- stopped gateway, restarted Client and gateway and review strategy logs showing no errors
- Start the strategy again and review issue was reproduced when gateway stopped and turn OFF
- start gateway again with yarn start —passphrase=password. Gateway turned into ONLINE again and
recovered
- connected dexalot/pancakeswap and checked balance successfully after the restart
- created/started pancakeswap amm_arb successfully
- amm_arb order execution using uniswap arbitrum one after gateway restart: ok
- manually built docker image successfully
- Reviewed HB gateway compose was
able to recover
after gateway disconnected
OjusWiZard
changed the title
fix/ issue #164
fix/ issue #164: Race condition in init() of connector classes
Sep 14, 2023
fengtality
approved these changes
Oct 14, 2023
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
2 tasks
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.
Before submitting this PR, please make sure:
A description of the changes proposed in the pull request:
This PR attempts to fix the issue #164. I observed that the cause of the errors in this issue is the following sequence:
/amm/price
request is made.init()
function for the first time and the promise is returned which is awaited./amm/price
calls are made.ready()
function still returnsfalse
because the firstinit()
call is not finished yet./amm/price
request again calls theinit()
function.this._initializing
was true. Hence, theseinit()
calls finished before the firstinit()
call.getTokenBySymbol()
because the tokens are yet to load from the firstinit()
call.Solution: The latter
init()
calls are made to wait while some otherinit()
call is in progress. This is done by having a promise (this._initialized
), that is unresolved whenever theinit()
is in progress.Tests performed by the developer:
I tested the cases described in the issue thread around ten times. The errors didn't occur in any case.