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

Make ServerState announcements work better #93

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Conversation

borzunov
Copy link
Collaborator

@borzunov borzunov commented Nov 28, 2022

  • Before this PR, ServerState.JOINING was announced only once. This announcement quickly expires in case of the full-size BLOOM, since loading blocks takes several minutes. This PR fixes it, so ServerState.JOINING is announced periodically in a thread until blocks are loaded.

  • This PR also makes the Server class a non-thread, so it runs in the main thread and can catch KeyboardInterrupt. This is important, since if we are downloading blocks right now, we need to stop it and send the ServerState.OFFLINE message. Note that ModuleContainer is still a thread.

  • (minor) For the sake of readability, I moved the ModuleContainer.create() definition, so it is now defined before Server.__init__() (this is because .create() is invoked first).

@borzunov borzunov force-pushed the fix-joining-announce branch 2 times, most recently from 77c51d8 to 06a8246 Compare November 28, 2022 03:19
@borzunov borzunov changed the title Announce ServerState.JOINING periodically Make ServerState announcements work better Nov 28, 2022
@borzunov borzunov merged commit 8a73b41 into main Nov 28, 2022
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.

None yet

1 participant