Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarthik nayak <knayak@gitlab.com>2023-12-15 15:53:43 +0300
committerGitLab <noreply@gitlab.com>2023-12-15 15:53:43 +0300
commit95dd9a8271285cf4a7aa4c42ca82319180643f2e (patch)
tree369d15c260abbc1cae6b77b9c1001abffc17ab01
parent0ba9e76dd638521b39158d410e919ccd7397b019 (diff)
parentb979e8373748126aaf64fdb4c9adb3413b6b66ab (diff)
Merge branch 'qmnguyen0711/adjust-stale-file-grace-period' into 'master'
Adjust housekeeping's grace period of stale file cleaning See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6584 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: James Liu <jliu@gitlab.com> Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Quang-Minh Nguyen <qmnguyen@gitlab.com>
-rw-r--r--internal/git/housekeeping/clean_stale_data.go2
-rw-r--r--internal/git/housekeeping/clean_stale_data_test.go24
2 files changed, 23 insertions, 3 deletions
diff --git a/internal/git/housekeeping/clean_stale_data.go b/internal/git/housekeeping/clean_stale_data.go
index 6cffe2cc9..22149d639 100644
--- a/internal/git/housekeeping/clean_stale_data.go
+++ b/internal/git/housekeeping/clean_stale_data.go
@@ -22,7 +22,7 @@ import (
const (
emptyRefsGracePeriod = 24 * time.Hour
- deleteTempFilesOlderThanDuration = 7 * 24 * time.Hour
+ deleteTempFilesOlderThanDuration = 24 * time.Hour
brokenRefsGracePeriod = 24 * time.Hour
lockfileGracePeriod = 15 * time.Minute
referenceLockfileGracePeriod = 1 * time.Hour
diff --git a/internal/git/housekeeping/clean_stale_data_test.go b/internal/git/housekeeping/clean_stale_data_test.go
index 96e6752bd..6e3b9cb3f 100644
--- a/internal/git/housekeeping/clean_stale_data_test.go
+++ b/internal/git/housekeeping/clean_stale_data_test.go
@@ -1069,7 +1069,7 @@ func TestIsStaleTemporaryObject(t *testing.T) {
expectIsStale: false,
},
{
- name: "recent_time_file",
+ name: "recent time file",
dirEntry: mockDirEntry{
name: "tmp_DELETEME",
fi: mockFileInfo{
@@ -1079,7 +1079,27 @@ func TestIsStaleTemporaryObject(t *testing.T) {
expectIsStale: false,
},
{
- name: "old temp file",
+ name: "recent time file",
+ dirEntry: mockDirEntry{
+ name: "tmp_DELETEME",
+ fi: mockFileInfo{
+ modTime: time.Now().Add(-23 * time.Hour),
+ },
+ },
+ expectIsStale: false,
+ },
+ {
+ name: "very old temp file",
+ dirEntry: mockDirEntry{
+ name: "tmp_DELETEME",
+ fi: mockFileInfo{
+ modTime: time.Now().Add(-25 * time.Hour),
+ },
+ },
+ expectIsStale: true,
+ },
+ {
+ name: "very old temp file",
dirEntry: mockDirEntry{
name: "tmp_DELETEME",
fi: mockFileInfo{