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

Added feature to shutdown the logger properly if the server crashes unexpectedly #16

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

PotatoPeeler3000
Copy link
Collaborator

We need to get a certain amount of ticks in a row without a new timestamp, then we shutdown.
This is because if power is lost to the server the JVM doesn't shutdown properly, therefore we can keep logging useless data, this prevents that.

@@ -563,13 +576,26 @@ public void receivedTimestampOnly(long timestamp)
{
synchronized (timestampUpdater)
{
// We haven't received any new timestamps, shutdown the logger gracefully
if (ticksWithoutNewTimestamp == TICKS_WITHOUT_DATA_BEFORE_SHUTDOWN)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this if (!alreadyShutDown && ticksWithoutNewTimestamp >= TICKS_WITHOUT_DATA_BEFORE_SHUTDOWN)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya good call


if (alreadyShutDown)
{
LogTools.info("This may have already shutdown properly due to the server losing power for an extended amount of time");
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessarily because of loss of power. I think you should just make this say This may have already shutdown properly because the connection to the YoVariableServer was lost

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair, went with: "This may have already shutdown because the connection to the server was lost"

@PotatoPeeler3000 PotatoPeeler3000 merged commit ffd23d5 into develop Sep 18, 2024
2 checks passed
@PotatoPeeler3000 PotatoPeeler3000 deleted the feature/shutdown-properly branch September 18, 2024 17:10
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.

2 participants