mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
fix: remove inline GC and schedule a background task instead (#1610)
* fix: remove inline GC and set a default value of gc interval - remove inline GC - add a default value of GC interval - run the GC periodically by default with the default value if no interval provided - generate GC tasks with a random delay(0-30s) between - add IsReady() method to scheduler.TaskGenerator interface Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com> * ci: add test for gc with short interval Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com> --------- Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
@@ -114,6 +114,10 @@ func (gen *TaskGenerator) IsDone() bool {
|
||||
return gen.done
|
||||
}
|
||||
|
||||
func (gen *TaskGenerator) IsReady() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (gen *TaskGenerator) Reset() {
|
||||
gen.lastRepo = ""
|
||||
gen.Service.ResetCatalog()
|
||||
|
||||
@@ -131,6 +131,7 @@ func makeUpstreamServer(
|
||||
}
|
||||
|
||||
srcConfig.HTTP.Port = srcPort
|
||||
srcConfig.Storage.GC = false
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
@@ -1663,6 +1664,7 @@ func TestPermsDenied(t *testing.T) {
|
||||
|
||||
destDir := t.TempDir()
|
||||
|
||||
destConfig.Storage.GC = false
|
||||
destConfig.Storage.RootDirectory = destDir
|
||||
|
||||
destConfig.Extensions = &extconf.ExtensionConfig{}
|
||||
@@ -3038,6 +3040,8 @@ func TestSubPaths(t *testing.T) {
|
||||
|
||||
srcConfig.HTTP.Port = srcPort
|
||||
|
||||
srcConfig.Storage.GC = false
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
subpath := "/subpath"
|
||||
@@ -4506,6 +4510,7 @@ func TestOnDemandRetryGoroutine(t *testing.T) {
|
||||
srcBaseURL := test.GetBaseURL(srcPort)
|
||||
|
||||
srcConfig.HTTP.Port = srcPort
|
||||
srcConfig.Storage.GC = false
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
@@ -4712,6 +4717,7 @@ func TestOnDemandMultipleImage(t *testing.T) {
|
||||
srcBaseURL := test.GetBaseURL(srcPort)
|
||||
|
||||
srcConfig.HTTP.Port = srcPort
|
||||
srcConfig.Storage.GC = false
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user