Skip to content

Commit abeee87

Browse files
committed
refactor(connections): align UpsertStatus guild filter; validate heartbeat timeout < interval
1 parent fecd30c commit abeee87

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/RustPlusBot.Host/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"Connections:MaxRetryDelay must be at least InitialRetryDelay.")
4747
.Validate(static o => o.HeartbeatInterval > TimeSpan.Zero, "Connections:HeartbeatInterval must be positive.")
4848
.Validate(static o => o.HeartbeatTimeout > TimeSpan.Zero, "Connections:HeartbeatTimeout must be positive.")
49+
.Validate(static o => o.HeartbeatTimeout < o.HeartbeatInterval,
50+
"Connections:HeartbeatTimeout must be less than HeartbeatInterval.")
4951
.ValidateOnStart();
5052
builder.Services.AddConnections();
5153

src/RustPlusBot.Persistence/Connections/ConnectionStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task<bool> UpsertStatusAsync(
2828
CancellationToken cancellationToken = default)
2929
{
3030
var existing = await context.ConnectionStates
31-
.SingleOrDefaultAsync(s => s.RustServerId == serverId, cancellationToken)
31+
.SingleOrDefaultAsync(s => s.GuildId == guildId && s.RustServerId == serverId, cancellationToken)
3232
.ConfigureAwait(false);
3333

3434
if (existing is null)

0 commit comments

Comments
 (0)