-
Notifications
You must be signed in to change notification settings - Fork 820
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
Unity SDK: Added ability to Start / Stop healthchecks. #1598
Conversation
There was no option to start / stop healthchecks manually. Now we have both options to start / stop healthchecs manually or automaticaly.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Davidnovarro The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Build Succeeded 👏 Build Id: af8c1e63-2c16-4255-89af-f7eb7511d214 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this through 👍 I had some follow up questions attached in my review.
This PR closes the issue #1583
Also, as a note, this doesn't close that issue, that issue is regarding the C# SDK.
I hope you don't mind, I added "Unity SDK" to the ticket title to give it some more context.
Thanks!
/// </summary> | ||
public bool healthEnabled = true; | ||
[SerializeField] private bool startHealthChecks = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good reason to change this name?
This would be a breaking change for the SDK, so we would like to avoid that where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, changing the encapsulation would also be a breaking change. Is there a good reason to do that as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good reason to change this name?
The name itself is misleading, for example, the user may set it to true externally and expect health checks to start, which won't work because the variable is only checked in the Start method, in case if it was set to true then health checks start.
Also, changing the encapsulation would also be a breaking change. Is there a good reason to do that as well?
I think this variable previously was made public so unity will be able to serialize and show it in the Inspector it basically has no external use case, see code examples below.
void Start()
{
sdk.healthEnabled = true; //There is a 50 % chance that the health checks will start due to Unity random scheduling.
}
void Update()
{
if(someCondition)
sdk.healthEnabled = true; //This won't work.
if(someOtherCondition)
sdk.healthEnabled = false; //This doesn't make sense because we can't renew the health checks, instead we can use sdk.Shutdown()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm not sure why you would be trying to dynamically decide if health checking is enable or not - you would enable health checking if you have it turned on on Agones. That's really it.
Health checking is not a tool for managing game server lifecycles.
This doesn't sound like a good reason to introduce a breaking change on both naming and encapsulation.
/// <summary> | ||
/// Start sending health ping to the Agones sidecar. | ||
/// </summary> | ||
public void StartHealthChecks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this through. I'm curious though - what's the use case for these functions?
Was there a particular scenario in which you would want to manually start the health check process, rather than have it be part of the component?
Also, when would you want to stop a health check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when would you want to stop a health check?
In my particular case, I do resue my game servers for a long period of time and they all have two external connections with Backend Servers (economy, rewards, etc..) and Party Servers (matchmaking, tickets, backfill).
In case if the GS loses the connection I mark it as non-healthy until the connection is restored.
There may be other use cases like the first match is complete but GS can't load the resources to continue.
Was there a particular scenario in which you would want to manually start the health check process, rather than have it be part of the component?
Yes, like GS was able to restore the connection or load the resources or some background process was revived.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case if the GS loses the connection I mark it as non-healthy until the connection is restored.
This sounds like a very dangerous approach -- I wouldn't advise it. Unhealthy game servers have failed a health check and are deemed to not be alive. If this GameServer was part of a Fleet, it would immediately be shut down and recreated.
Yes, like GS was able to restore the connection or load the resources or some background process was revived.
I can't advocate for any of these scenarios.
This could be solved using custom labels for example, without abusing health checking abilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you are right, this PR can be removed.
Build Succeeded 👏 Build Id: 3837d59c-6090-4071-ab66-e3d92c694669 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Thanks for working through this with me though! Appreciate you taking the time 👍 |
There was no public method to start/stop health checks manually.
Now we have both options to start/stop health checks manually or automatically.