Force runIntervalSeconds to never fall below 1 to stop peope breaking their server by editing config values blindly

This commit is contained in:
Dev 2024-03-14 14:43:56 +00:00
parent 42c4b6bd4d
commit 2bbbbb9736

View File

@ -52,7 +52,8 @@ export class InsuranceCallbacks implements OnUpdate
public async onUpdate(secondsSinceLastRun: number): Promise<boolean> public async onUpdate(secondsSinceLastRun: number): Promise<boolean>
{ {
if (secondsSinceLastRun > this.insuranceConfig.runIntervalSeconds) // People edit the config value to be 0 and break it, force value to no lower than 1
if (secondsSinceLastRun > Math.max(this.insuranceConfig.runIntervalSeconds, 1))
{ {
this.insuranceController.processReturn(); this.insuranceController.processReturn();
return true; return true;