Skip to content

Commit 158eb5b

Browse files
committed
Little fixes on maintenance
1 parent bbc58ba commit 158eb5b

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/SharedKernel/Maintenance/MaintenanceCachePoller.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
namespace SharedKernel.Maintenance;
55

6+
//This is for local cache entity to poll the maintenance mode from distributed cache
7+
//This should be removed then L1 + L2 cache is implemented in hybrid cache
68
internal class MaintenanceCachePoller(HybridCache hybridCache, MaintenanceState state) : BackgroundService
79
{
810
protected override async Task ExecuteAsync(CancellationToken stoppingToken)

src/SharedKernel/Maintenance/MaintenanceMode.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,4 @@ public enum MaintenanceMode
55
Disabled = 0,
66
EnabledForClients = 1,
77
EnabledForAll = 2
8-
}
9-
10-
//This is for local cache entity to poll the maintenance mode from distributed cache
11-
//This should be removed then L1 + L2 cache is implemented in hybrid cache
12-
13-
// This is a local cache entity to hold the maintenance mode in memory
14-
// This should be removed then L1 + L2 cache is implemented in hybrid cache
15-
// thread-safe local snapshot
8+
}

src/SharedKernel/Maintenance/MaintenanceState.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace SharedKernel.Maintenance;
44

5+
// This is a local cache entity to hold the maintenance mode in memory
6+
// This should be removed then L1 + L2 cache is implemented in hybrid cache
7+
// thread-safe local snapshot
58
public sealed class MaintenanceState(HybridCache cache)
69
{
710
private const string Key = "maintenance-mode";
@@ -16,7 +19,6 @@ public MaintenanceMode Mode
1619
// for admin/API to change mode (updates local immediately, then L2)
1720
public async Task SetModeAsync(MaintenanceMode mode, CancellationToken ct = default)
1821
{
19-
Mode = mode;
2022
await cache.SetAsync(
2123
Key,
2224
new MaintenanceCacheEntity
@@ -30,6 +32,8 @@ await cache.SetAsync(
3032
Flags = null
3133
},
3234
cancellationToken: ct);
35+
36+
Mode = mode;
3337
}
3438

3539
// used by the poller only

0 commit comments

Comments
 (0)