Idea

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) suggested

Automatically shutdown a server after X amount of time

Due to a server bug, we have servers that start up, but remain in some "limbo" state where they are taking up server resources, but not actually allowing players to connect.

It would be very nice if we could turn on a feature that auto-terminated long-running servers. Our game sessions are about 25 minutes long on average, and max out around 35 minutes, so absolutely nothing should be running beyond an hour.

I would love to be able to automatically terminate servers after an hour.

Custom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

2 Comments

·
Chad Franklin avatar image
Chad Franklin commented

Any chance you've encountered a solution for this?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brandon@uprootstudios.com avatar image
brandon@uprootstudios.com commented

We terminate our sessions after a certain time limit. In Unity, what we do is:

void Update() {
    if (Time.timeSinceLevelLoad > maxTime) {
        Shutdown();
    }
}
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Chad Franklin avatar image Chad Franklin commented ·

Good enough for me. Thanks :)

0 Likes 0 ·
brandon@uprootstudios.com avatar image brandon@uprootstudios.com Chad Franklin commented ·

@Chad Franklin Sure thing! Although, since this would be run every frame, you might want to instead do something like:

private bool didShutdown = false;

void Update() {
    if (Time.timeSinceLevelLoad > maxTime && !didShutdown) {
        didShutdown = true;
        //your shutdown code here
    }
}
1 Like 1 ·
Chad Franklin avatar image Chad Franklin brandon@uprootstudios.com commented ·

Thanks again for pointing that out, probably just saved me a lot of trouble.

0 Likes 0 ·

Write a Comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.