Skip to content

Commit 9468ae6

Browse files
committed
fix: improve backup timestamp resolution to prevent filename collisions
- Add milliseconds to backup timestamp format (%Y%m%d_%H%M%S_%3f) - Reduce sleep duration in cleanup test from 100ms to 50ms - Prevents multiple backups from having same timestamp - Fixes CI test failure where only 1 backup remained instead of 2
1 parent 3742e8a commit 9468ae6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"Bash(cargo check:*)",
1919
"Bash(gh project item-edit:*)",
2020
"WebFetch(domain:app.codecov.io)",
21-
"Bash(grep:*)"
21+
"Bash(grep:*)",
22+
"Bash(gh pr checks:*)"
2223
],
2324
"deny": []
2425
}

mcp-auth/src/storage.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl FileStorage {
312312
));
313313
}
314314

315-
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
315+
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S_%3f");
316316
let backup_path = self
317317
.path
318318
.with_extension(format!("backup_{}.enc", timestamp));
@@ -1281,8 +1281,8 @@ mod tests {
12811281
for _i in 0..5 {
12821282
let backup_path = storage.create_backup().await.unwrap();
12831283
backup_paths.push(backup_path);
1284-
// Longer delay to ensure different timestamps and avoid race conditions
1285-
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
1284+
// Small delay to ensure different timestamps
1285+
tokio::time::sleep(tokio::time::Duration::from_millis(50)).await;
12861286
}
12871287

12881288
// Verify all backups exist

0 commit comments

Comments
 (0)