Skip to content

Commit f8ae6e6

Browse files
committed
Add config support for compiler shutdown
1 parent 7313cc4 commit f8ae6e6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/CompilerService.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,10 @@ private void OnMessage(ObjectStreamConnection<CompilerMessage, CompilerMessage>
334334
}
335335
compilations.Remove(message.Id);
336336

337-
// if (compilations.Count == 0)
338-
// {
339-
// Stop(false, "no more jobs");
340-
// }
337+
if (!Interface.Oxide.Config.Compiler.IdleShutdown && compilations.Count == 0)
338+
{
339+
Stop(false, "no more jobs");
340+
}
341341

342342
break;
343343

@@ -429,7 +429,10 @@ private void ResetIdleTimer()
429429
idleTimer.Destroy();
430430
}
431431

432-
idleTimer = Interface.Oxide.GetLibrary<Core.Libraries.Timer>().Once(300f, () => Stop(false, "idle shutdown"));
432+
if (Interface.Oxide.Config.Compiler.IdleShutdown)
433+
{
434+
idleTimer = Interface.Oxide.GetLibrary<Core.Libraries.Timer>().Once(Interface.Oxide.Config.Compiler.IdleTimeout, () => Stop(false, "idle shutdown"));
435+
}
433436
}
434437

435438
internal void Compile(CompilablePlugin[] plugins, Action<Compilation> callback)

0 commit comments

Comments
 (0)