fix(online): honor runtime disable in sync loop to stop OIDC discovery
OnlineSyncService is registered once at startup; toggling the feature off in Settings persisted the flag but never stopped the running loop, so it kept polling and failing OIDC discovery every cycle. Guard TickAsync on the shared config's Enabled flag so disabling takes effect live.
This commit is contained in:
@@ -55,9 +55,9 @@ public sealed class OnlineSyncServiceTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private OnlineSyncService BuildService(FakeApi api, string? token = "test-token")
|
||||
private OnlineSyncService BuildService(FakeApi api, string? token = "test-token", bool enabled = true)
|
||||
{
|
||||
var config = new OnlineInboxConfig { Enabled = true, PollIntervalSeconds = 60 };
|
||||
var config = new OnlineInboxConfig { Enabled = enabled, PollIntervalSeconds = 60 };
|
||||
var auth = new StaticTokenAuthProvider(token);
|
||||
return new OnlineSyncService(
|
||||
_db.CreateFactory(),
|
||||
@@ -209,6 +209,18 @@ public sealed class OnlineSyncServiceTests : IDisposable
|
||||
Assert.Equal(0, api.CallCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Tick_Disabled_SkipsCycle_NoApiCalls()
|
||||
{
|
||||
_ = await SeedAsync();
|
||||
var api = new FakeApi();
|
||||
var svc = BuildService(api, enabled: false);
|
||||
|
||||
await svc.TickAsync(CancellationToken.None);
|
||||
|
||||
Assert.Equal(0, api.CallCount);
|
||||
}
|
||||
|
||||
// ---- multi-user: owner stamping + guard ----
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user