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

Kubernetes integration and graceful shutdown #960

Merged
merged 18 commits into from
Oct 22, 2023

Conversation

Askaholic
Copy link
Collaborator

Adds a graceful shutdown mode where the server will stop allowing new games to be created and wait until all active games have completed before shutting down normally. The grace period time before a hard shutdown happens can be configured or short circuited by sending a second SIGTERM or SIGINT to the process.

Also adds a kubernetes health check server on port 2000 by default that will ensure kubernetes waits long enough for the server to start before sending over new traffic.

Closes #469

@p4block
Copy link

p4block commented Apr 16, 2023

This is great stuff, reminds me of how LiveKit works.

terminationGracePeriodSeconds to 5 hours in the helm chart, ensuring Kubernetes gives sufficient time for the pod to gracefully shut down.

Extremely doable :D

@Askaholic Askaholic force-pushed the k8s-integration branch 2 times, most recently from 51b6595 to 939ac58 Compare April 16, 2023 20:17
except Exception as ex: # pragma: no cover
except DisabledError:
# TODO: Respond with correlation uid for original message
await self.send({"command": "disabled", "request": cmd})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could rename the field to something else. Maybe request_command?

@Askaholic
Copy link
Collaborator Author

Askaholic commented Apr 16, 2023

Looks like the queue pop time delta becomes negative and the pop_time being in the past causes the client UI to bug out a little bit. We should probably handle that on the server and just send a 0 or null or something.

{'command': 'matchmaker_info', 'queues': [{'queue_name': 'ladder1v1', 'queue_pop_time': '2023-04-16T22:13:07.857983+00:00', 'queue_pop_time_delta': -1249.9953863620758, 'num_players': 0, 'boundary_80s': [], 'boundary_75s': [], 'team_size': 1}, {'queue_name': 'tmm2v2', 'queue_pop_time': '2023-04-16T22:13:07.858472+00:00', 'queue_pop_time_delta': -1249.9949333667755, 'num_players': 0, 'boundary_80s': [], 'boundary_75s': [], 'team_size': 2}, {'queue_name': 'tmm4v4_full_share', 'queue_pop_time': '2023-04-16T22:13:07.828933+00:00', 'queue_pop_time_delta': -1250.0244863033295, 'num_players': 0, 'boundary_80s': [], 'boundary_75s': [], 'team_size': 4}, {'queue_name': 'tmm4v4', 'queue_pop_time': '2023-04-16T22:13:07.831161+00:00', 'queue_pop_time_delta': -1250.0222806930542, 'num_players': 0, 'boundary_80s': [], 'boundary_75s': [], 'team_size': 4}]}

We might want the matchmaker_info message to actually return an empty list when the queues are disabled.

server/lobbyconnection.py Outdated Show resolved Hide resolved
@Askaholic Askaholic merged commit 883dda8 into FAForever:develop Oct 22, 2023
6 of 7 checks passed
@Askaholic Askaholic deleted the k8s-integration branch October 22, 2023 16:50
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.

Gracefully shut down server
2 participants