Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit039afdb

Browse files
committed
chore: remove global retention fallback for connection logs
Connection logs retention is now explicit - it's enabled when--connection-logs-retention is set to a non-zero duration, anddisabled when set to 0. No fallback to global retention.
1 parent61498b8 commit039afdb

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

‎coderd/database/dbpurge/dbpurge.go‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const (
2121
delay=10*time.Minute
2222
maxAgentLogAge=7*24*time.Hour
2323
// Connection events are now inserted into the `connection_logs` table.
24-
// We'll slowly remove old connection events from the `audit_logs` table,
25-
//but we won't touchthe`connection_logs` table.
24+
// We'll slowly remove old connection events from the `audit_logs` table.
25+
//The `connection_logs` table is purged based ontheconfigured retention.
2626
maxAuditLogConnectionEventAge=90*24*time.Hour// 90 days
2727
auditLogConnectionEventBatchSize=1000
2828
// Batch size for connection log deletion. Smaller batches prevent long-held
@@ -116,9 +116,6 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder
116116

117117
varpurgedConnectionLogsint64
118118
connectionLogsRetention:=vals.Retention.ConnectionLogs.Value()
119-
ifconnectionLogsRetention==0 {
120-
connectionLogsRetention=vals.Retention.Global.Value()
121-
}
122119
ifconnectionLogsRetention>0 {
123120
deleteConnectionLogsBefore:=start.Add(-connectionLogsRetention)
124121
purgedConnectionLogs,err=tx.DeleteOldConnectionLogs(ctx, database.DeleteOldConnectionLogsParams{

‎coderd/database/dbpurge/dbpurge_test.go‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -795,17 +795,6 @@ func TestDeleteOldConnectionLogs(t *testing.T) {
795795
expectOldDeleted:false,
796796
expectedLogsRemaining:1,// old log is kept
797797
},
798-
{
799-
name:"GlobalRetentionFallback",
800-
retentionConfig: codersdk.RetentionConfig{
801-
Global:serpent.Duration(retentionPeriod),
802-
ConnectionLogs:serpent.Duration(0),// Not set, should fall back to global
803-
},
804-
oldLogTime:afterThreshold,
805-
recentLogTime:&beforeThreshold,
806-
expectOldDeleted:true,
807-
expectedLogsRemaining:1,// only recent log remains
808-
},
809798
}
810799

811800
for_,tc:=rangetestCases {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp