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

Old subs from previous connection are never resubscribed. #800

Open
bryaan opened this issue Dec 4, 2024 · 8 comments
Open

Old subs from previous connection are never resubscribed. #800

bryaan opened this issue Dec 4, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@bryaan
Copy link

bryaan commented Dec 4, 2024

new_subs = self.scheduled_subs.difference(self.subs)

Old subs from previous connection are never resubscribed.

@justinpolygon
Copy link
Contributor

Hey @bryaan, can you provide a little more information about what you're seeing and how I can reproduce this? I just wanted to more sure I can reproduce it and verify the fix.

@bryaan
Copy link
Author

bryaan commented Dec 4, 2024

If the websocket disconnects and retries and succeeds, the old subs are not resubbed.

@justinpolygon
Copy link
Contributor

Perfect, thanks @bryaan. I'll check it out.

@bryaan
Copy link
Author

bryaan commented Dec 4, 2024

It seems if i set reconnects to 0 and write a loop for connect and manually resub it works. So the issue looks confirmed with the internal resub logic.

@justinpolygon
Copy link
Contributor

Cool, thanks for checking @bryaan.

@justinpolygon justinpolygon self-assigned this Dec 4, 2024
@justinpolygon justinpolygon added the bug Something isn't working label Dec 4, 2024
@bryaan
Copy link
Author

bryaan commented Dec 4, 2024

Actually there seems to be another issue at work. I am subscribing to 4000+ symbols, the ws seems to either stop processing after some point or it's disconnecting and not returning. I turned on verbose logging to see if I can narrow it down.

@justinpolygon
Copy link
Contributor

Hey @bryaan, another option might be to something like subscribing to * all tickers and then in your code narrowing it down to what you're interested in. I remember doing something similar way back and it seemed to be easier to do it that way. Just less complex code handling everything. Then, you'll just have a map or something that quickly checks to see if the ticker you're seeing from the websocket is the ticker you're interested in. I guess it depends on what you're doing but for all of NASDAQ and NYSE it's something like 5300 tickers. So, you're almost looking at everything anyways.

@bryaan
Copy link
Author

bryaan commented Dec 4, 2024

But why would your suggestion work and this does not? I'm subbing like this:

self.ws_client.subscribe(*tickers_to_sub) # multiple tickers

Could it be a server error where they are keeping the connection open but not sending data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants