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

wip: reproduce timing issue #1740

Closed
wants to merge 1 commit into from
Closed

Conversation

bonomat
Copy link
Contributor

@bonomat bonomat commented Dec 13, 2023

if a position is getting resized we close the current contract and reopen a new one. It might happen that the task will pick it up in the meantime and set the to closed. This breaks the renew protocl because we expect the position to be in a certain state/

How to reproduce:

  • start the app
  • open position
  • resize/add contracts to the position

the task closed_position will pick it up and set the position to closed breaking the renew protocol.

if a position is getting resized we close the current contract and reopen a new one. It might happen that the task  will pick it up in the meantime and set the  to closed. This breaks the renew protocl because we expect the position to be in a certain state
@bonomat
Copy link
Contributor Author

bonomat commented Dec 13, 2023

Closing this as it's not meant to be merged

@bonomat bonomat closed this Dec 13, 2023
@@ -98,7 +98,17 @@ impl Node {
},
)?;

db::positions::Position::set_open_position_to_resizing(conn, position.trader.to_string())?;
let pool = self.pool.clone();
tokio::spawn({
Copy link
Contributor

Choose a reason for hiding this comment

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

Interestingly, I wasn't able to reproduce it, although I was using std::thread::spawn instead.

Copy link
Contributor

@luckysori luckysori left a comment

Choose a reason for hiding this comment

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

Thanks for the repro!

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.

2 participants