Skip to content

Commit 1eb72d5

Browse files
committed
autoregistrator: don't re-run Main() on loop-body exceptions
Main() does DeleteAllPackages + DeleteAllMaps so a transient failure in the periodic loop (e.g. springfiles 500, transient network blip) used to wipe the engine + zk + chobby via the goto-rerun pattern, and games couldn't start until everything re-downloaded. Now: catch exceptions inside the loop body and continue. Startup-time Main() failure still kills the thread (intentional).
1 parent cf0cc4c commit 1eb72d5

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

AutoRegistrator/AutoRegistrator.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,36 @@ public Thread RunMainAndMapSyncAsync()
8484
{
8585
var thread = new Thread(() =>
8686
{
87-
rerun:
8887
try
8988
{
9089
Main();
91-
while (true)
90+
}
91+
catch (Exception ex)
92+
{
93+
Trace.TraceError("Autoregistrator startup failed: {0}", ex);
94+
return;
95+
}
96+
97+
// loop body exceptions must NOT re-run Main(). Main() deletes all packages and maps, so a
98+
// transient failure (e.g. springfiles 500) would otherwise wipe the engine + zk + chobby
99+
// and prevent games from starting until everything finishes re-downloading.
100+
while (true)
101+
{
102+
try
92103
{
93104
Thread.Sleep(61 * 1000);
94105
if (Downloader.PackageDownloader.DoMasterRefresh()) OnRapidChanged();
95106

96-
97107
if (DateTime.UtcNow.Subtract(lastSpringFilesUpdate).TotalMinutes > 61)
98108
{
99109
lastSpringFilesUpdate = DateTime.UtcNow;
100110
SynchronizeMapsFromSpringFiles();
101111
}
102112
}
103-
}
104-
catch (Exception ex)
105-
{
106-
Trace.TraceError("Autoregistrator failure: {0}", ex);
107-
goto rerun;
113+
catch (Exception ex)
114+
{
115+
Trace.TraceError("Autoregistrator iteration failed (continuing): {0}", ex);
116+
}
108117
}
109118
});
110119
thread.Start();

0 commit comments

Comments
 (0)