Skip to content

Commit b41cbf5

Browse files
committed
skip GC when local pinning is in progress
1 parent 0a27963 commit b41cbf5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

blox/blox.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,18 @@ func (p *Blox) Start(ctx context.Context) error {
622622
if p.topicName != "0" {
623623
shortCtx, shortCtxCancel := context.WithDeadline(p.ctx, time.Now().Add(60*time.Second))
624624
defer shortCtxCancel()
625-
p.rpc.Request("repo/gc").Send(shortCtx)
625+
// Skip GC if fula-pinning is actively syncing
626+
syncingPath := "/internal/fula-pinning/.syncing"
627+
skipGC := false
628+
if info, err := os.Stat(syncingPath); err == nil {
629+
if time.Since(info.ModTime()) < 30*time.Minute {
630+
log.Info("Skipping repo/gc: fula-pinning sync in progress")
631+
skipGC = true
632+
}
633+
}
634+
if !skipGC {
635+
p.rpc.Request("repo/gc").Send(shortCtx)
636+
}
626637
storedLinks, err := p.ListModifiedStoredBlocks(lastCheckedTime)
627638
if err != nil {
628639
log.Errorf("Error listing stored blocks: %v", err)

0 commit comments

Comments
 (0)