mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-28 15:37:14 +00:00
fix(ugc): stopping the UGC server cancels the models being made
Stopping waited for every worker to finish its model, and with the path traced hidden-face removal a big model takes minutes, so a restart hung. UgcThrottle::Cancel(true) (set by UgcProcessor::Stop) makes Checkpoint, which the long loops already call, throw UgcThrottle::Cancelled; the worker abandons the job without writing or recording anything, so its row stays waiting and is made again after the restart. The throttle's sleeps wake to check it. Previews answer 503. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,16 @@ namespace UgcThrottle {
|
||||
void SetBudget(double cpus);
|
||||
double GetBudget();
|
||||
|
||||
// Account the calling thread's CPU time and sleep when over the budget
|
||||
// Account the calling thread's CPU time and sleep when over the budget. Throws Cancelled once Cancel(true) was
|
||||
// called, so a job stops in moments when the server shuts down.
|
||||
void Checkpoint();
|
||||
|
||||
// Thrown by Checkpoint while cancelled: the job is abandoned, not failed (its row stays waiting)
|
||||
struct Cancelled {};
|
||||
// Stop (true) or allow (false) every job's work: set when the server stops, cleared when it starts
|
||||
void Cancel(bool cancel);
|
||||
bool IsCancelled();
|
||||
|
||||
// Start accounting on this thread from now (a worker starting a job), so time spent idle isn't counted
|
||||
void Begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user