Skip to content

Commit 95e7fe8

Browse files
committed
Add compiler shutdown once all jobs finish
1 parent 60ff91e commit 95e7fe8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/CompilerService.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private void ExpireFileCache()
9999

100100
if (index <= 0) return;
101101

102-
Interface.Oxide.LogWarning($"[CSharp] Released {index} cached compiler dependencies, running garbage collection. . .");
102+
//Interface.Oxide.LogWarning($"[CSharp] Released {index} cached compiler dependencies, running garbage collection. . .");
103103
GC.Collect();
104104
}
105105
}
@@ -332,6 +332,12 @@ private void OnMessage(ObjectStreamConnection<CompilerMessage, CompilerMessage>
332332
compilation.Completed(result.Data, result.Symbols);
333333
}
334334
compilations.Remove(message.Id);
335+
336+
if (compilations.Count == 0)
337+
{
338+
Stop(false, "no more jobs");
339+
}
340+
335341
break;
336342

337343
case CompilerMessageType.Error:
@@ -406,7 +412,7 @@ private void ResetIdleTimer()
406412
idleTimer.Destroy();
407413
}
408414

409-
idleTimer = Interface.Oxide.GetLibrary<Core.Libraries.Timer>().Once(3600f, () => Stop(false, "idle shutdown"));
415+
idleTimer = Interface.Oxide.GetLibrary<Core.Libraries.Timer>().Once(300f, () => Stop(false, "idle shutdown"));
410416
}
411417

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

0 commit comments

Comments
 (0)