reserve

open suspend override fun reserve(seconds: Long)(source)

Notifies Agones to set this instance to Reserved state for a specific duration. This prevents the instance from being deleted during that time period and does not trigger any scaling within the fleet. After the duration passed, the instance will be set back to the Ready state. While the instance is in the Reserved state, it cannot be deleted by fleet updates or scaling, and it cannot be assigned with a GameServerAllocation. Invoking any state changing methods like allocate, ready or shutdown deactivates the scheduled reset to Ready after the duration expires.

This method can be used, for example, to enable registration with an external system such as a matchmaker, which required instances to mark themselves as ready for game sessions for a certain period of time. Once the game session has started, the implementation would then call allocate to indicate that the instance is now in active use and possibly hosting players.

Parameters

seconds

The duration in seconds for which this instance should be set to the Reserved state before transitioning back to Ready. A value of 0 indicates an unlimited duration.

See also

Throws

If the supplied seconds are less than 0 and therefore negative. This is impossible, as the time should be positive or 0 to set the time after which to reset its state.