gofinance / ib

Pure Go interface to Interactive Brokers IB API
391 stars 121 forks source link

Fix unsubscribe #29

Open nothize opened 7 years ago

nothize commented 7 years ago

Fix unsubscribe all and unmatched bug that removed other observers

Use a more efficient way to construct the new subscribe list while fixing the bug.

A test case is included as an earlier commit so that the bug can be reproduced by running the test case:

$ GATEWAY_URL=localhost:4003 go test -run TestUnsubscribe
=== RUN   TestUnsubscribeAllAndUnmatched
--- FAIL: TestUnsubscribeAllAndUnmatched (0.10s)
    engine_test.go:72: created engine for reuse
    engine_test.go:158: rc should be unsubscribed from allObservers
    engine_test.go:167: rc should be unsubscribed from unObservers
FAIL
exit status 1
FAIL    github.com/gofinance/ib 0.113s
nothize commented 5 years ago

@creack @indrekj @joelreymont @uwe

Please review, thanks!

creack commented 5 years ago

I'll give it a shot over the weekend.