perf: increase DB timeout to 120s, reduce retries to 3 with longer delay
Raspberry Pi PostgreSQL is I/O constrained. 60s timeout was too short for concurrent writes during heavy recording sessions, causing timeout + retry causing duplicate key violations. - CommandTimeout: 60s -> 120s - maxRetryCount: 5 -> 3 - maxRetryDelay: 10s -> 15s Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
This commit is contained in:
co-authored by
Claude Opus 4.8 noreply@anthropic.com
parent
524a053263
commit
46da2d78f0
@@ -132,7 +132,7 @@ if (connectionStringBuilder.Timeout <= 0)
|
|||||||
|
|
||||||
if (connectionStringBuilder.CommandTimeout <= 0)
|
if (connectionStringBuilder.CommandTimeout <= 0)
|
||||||
{
|
{
|
||||||
connectionStringBuilder.CommandTimeout = 60;
|
connectionStringBuilder.CommandTimeout = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectionStringBuilder.KeepAlive <= 0)
|
if (connectionStringBuilder.KeepAlive <= 0)
|
||||||
@@ -146,8 +146,8 @@ builder.Services.AddDbContext<LiveRecorderDbContext>(options =>
|
|||||||
npgsql.MigrationsAssembly(typeof(LiveRecorderDbContext).Assembly.FullName);
|
npgsql.MigrationsAssembly(typeof(LiveRecorderDbContext).Assembly.FullName);
|
||||||
npgsql.CommandTimeout(connectionStringBuilder.CommandTimeout);
|
npgsql.CommandTimeout(connectionStringBuilder.CommandTimeout);
|
||||||
npgsql.EnableRetryOnFailure(
|
npgsql.EnableRetryOnFailure(
|
||||||
maxRetryCount: 5,
|
maxRetryCount: 3,
|
||||||
maxRetryDelay: TimeSpan.FromSeconds(10),
|
maxRetryDelay: TimeSpan.FromSeconds(15),
|
||||||
errorCodesToAdd: null);
|
errorCodesToAdd: null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user