Skip to content

Commit c25248d

Browse files
committed
always add host to index if keepalive is running
1 parent d0ca8ed commit c25248d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/metadata.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ func (m *BlobCacheMetadata) SetHostKeepAlive(ctx context.Context, host *BlobCach
341341
return err
342342
}
343343

344+
err = m.AddHostToIndex(ctx, host)
345+
if err != nil {
346+
return err
347+
}
348+
344349
return m.rdb.Set(ctx, MetadataKeys.MetadataHostKeepAlive(host.Addr), hostBytes, time.Duration(defaultHostKeepAliveTimeoutS)*time.Second).Err()
345350
}
346351

pkg/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func NewCacheService(ctx context.Context, cfg BlobCacheConfig) (*CacheService, e
101101
func (cs *CacheService) HostKeepAlive() {
102102
err := cs.metadata.AddHostToIndex(cs.ctx, cs.cas.currentHost)
103103
if err != nil {
104-
Logger.Fatalf("Failed to add host to index? %v", err)
104+
Logger.Fatalf("Failed to add host to index: %v", err)
105105
}
106106

107107
ticker := time.NewTicker(time.Duration(defaultHostKeepAliveIntervalS) * time.Second)

0 commit comments

Comments
 (0)