Skip to content

Commit c465cdb

Browse files
committed
remove minInterval
1 parent 8c25f50 commit c465cdb

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

config/sync.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ var (
1313
WithDefaultValue("30m"),
1414
WithValidDuration())
1515

16-
// SyncMinInterval specifies the minimum interval at which images are synchronized if they were already synchronized before.
17-
SyncMinInterval = NewKey("sync.minInterval",
18-
WithDefaultValue("12h"),
19-
WithValidDuration())
20-
2116
// SyncRegistries specifies the repositories to use for pulling and pushing images.
2217
SyncRegistries = NewKey("sync.registries",
2318
WithDefaultValue([]map[string]interface{}{

internal/sync/images.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package sync
22

33
import (
44
"context"
5-
"fmt"
65
"strings"
76
"time"
87

9-
"github.com/Altinity/docker-sync/config"
108
"github.com/Altinity/docker-sync/internal/telemetry"
119
"github.com/Altinity/docker-sync/structs"
1210
"github.com/cenkalti/backoff/v4"
@@ -16,8 +14,6 @@ import (
1614
"go.uber.org/multierr"
1715
)
1816

19-
var lastSyncMap = make(map[string]time.Time)
20-
2117
func SyncImage(ctx context.Context, image *structs.Image) error {
2218
var merr error
2319

@@ -29,17 +25,6 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
2925
}
3026

3127
for _, tag := range tags {
32-
k := fmt.Sprintf("%s:%s", image.Source, tag)
33-
if t, ok := lastSyncMap[k]; ok {
34-
if time.Since(t) < config.SyncMinInterval.Duration() {
35-
log.Info().
36-
Str("source", image.GetSource()).
37-
Str("tag", tag).
38-
Msg("Skipping tag sync due to minimum interval")
39-
continue
40-
}
41-
}
42-
4328
if err := backoff.Retry(func() error {
4429
if err := SyncTag(image, tag, pullAuthName, pullAuth); err != nil {
4530
if strings.Contains(err.Error(), "HAP429") {
@@ -78,7 +63,6 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
7863
continue
7964
}
8065
}
81-
lastSyncMap[k] = time.Now()
8266
}
8367

8468
return merr

0 commit comments

Comments
 (0)