You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
Prerequisite:
1- Subscribe to the orders, e.g. with SubscribeUserOrdersKind
Reproduction steps:
1- create 2 or more limits order in an open position (so that an array is returned and not a single value)
2- click on "Cancel All"
Solution found: I'm not sure it's ideal, I also don't know why a pointer was returned instead of the value (again my Go knowledge are a bit limited) but my solution was simply to not return a pointer, just its value, it seems to do the trick. But whether there are other consequences?..
The text was updated successfully, but these errors were encountered:
This is an interesting one. I have done a little research and it looks like passing pointers on channels is slower as we use the heap rather than the stack. So maybe that is introducing the race. I always use pointers by default as I like to avoid unnecessary copying. However I guess my computer science is not that great. If your solution works then submit a PR for it.
Prerequisite:
1- Subscribe to the orders, e.g. with
SubscribeUserOrdersKind
Reproduction steps:
1- create 2 or more limits order in an open position (so that an array is returned and not a single value)
2- click on "Cancel All"
An array of cancelled orders is returned in a websocket by Deribit. This code https://github.com/adampointer/go-deribit/blob/master/v3/rpc_subscriptions.go#L759 handles the array and sends each element to the channel here https://github.com/adampointer/go-deribit/blob/master/v3/rpc_subscriptions.go#L765. For some reasons, which I'm not aware of due to my limited knowledge in Go, the channel receives the same pointer address for the first two elements. The third element (if there were 3 open orders) is another order.
Solution found: I'm not sure it's ideal, I also don't know why a pointer was returned instead of the value (again my Go knowledge are a bit limited) but my solution was simply to not return a pointer, just its value, it seems to do the trick. But whether there are other consequences?..
The text was updated successfully, but these errors were encountered: