Service: always-on update log + "View service update log" menu item
Local checkpoint - NOT for public release. Ed wants logging for the service updating.
- New ALWAYS-ON update log at ProgramData\RemSound\service\update.log (not gated on the
service-logging toggle - updates are rare but important). It records the full sequence:
* "update detected: newer RemSound.exe (5.3) found, running 5.2 - restarting"
* the restarter's own "stopping" / "service started" (or "START FAILED - <reason>")
* "update complete: now running version 5.3"
The restart PowerShell writes its stop/start outcome itself, so the part that runs AFTER
the old service process is gone - and any failed start - is still captured. A pending
marker set at detection and consumed on the next start closes the loop (its absence flags
a stuck update).
- Service menu gains "View service update log" to open it (friendly message if none yet).
Update log + pending-marker round-trip covered by the isolation self-test. Gate 27/27.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d5767050f2
commit
4b2ecca960
@@ -46,6 +46,8 @@ public sealed class RemSoundService : ServiceBase
|
||||
// Record the running version + start time so the app's Service menu can show them — this is how a
|
||||
// self-update is visible (the version bumps and the start time is recent).
|
||||
try { ServiceStore.SaveStatus(new ServiceStore.ServiceStatus { Version = versionText, StartedUtc = DateTime.UtcNow }); } catch { }
|
||||
// If this start is the completion of a self-update restart, close the loop in the update log.
|
||||
try { if (ServiceStore.ConsumeUpdatePending()) ServiceStore.AppendUpdateLog($"update complete: now running version {versionText}"); } catch { }
|
||||
host = ServiceSendHost.FromConfig(msg => log?.Event(msg));
|
||||
worker = new Thread(() =>
|
||||
{
|
||||
@@ -66,6 +68,11 @@ public sealed class RemSoundService : ServiceBase
|
||||
if (restartScheduled) return;
|
||||
if (!ServiceUpdate.UpdateLanded()) return;
|
||||
restartScheduled = true;
|
||||
var running = ServiceUpdate.RunningVersion();
|
||||
var runningText = running is null ? "?" : $"{running.Major}.{running.Minor}";
|
||||
// Always-on update log (not gated on the service-logging toggle) — updates are rare + important.
|
||||
ServiceStore.AppendUpdateLog($"update detected: newer RemSound.exe ({ServiceUpdate.OnDiskVersion()}) found, running {runningText} — restarting to update");
|
||||
ServiceStore.SetUpdatePending();
|
||||
log?.Event("service: a newer RemSound version was installed — restarting to update");
|
||||
ServiceUpdate.RestartSelf();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user