Skip to content

Commit

Permalink
Fix health check spamming the expiry index
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson committed Jul 22, 2024
1 parent 4fdae71 commit 903c937
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion das/local_file_storage_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,14 @@ func (s *LocalFileStorageService) String() string {

func (s *LocalFileStorageService) HealthCheck(ctx context.Context) error {
testData := []byte("Test-Data")
err := s.Put(ctx, testData, uint64(time.Now().Add(time.Minute).Unix()))
// Store some data with an expiry time at the start of the epoch.
// If expiry is disabled it will only create an index entry for the
// same timestamp each time the health check happens.
// If expiry is enabled, it will be cleaned up each time the pruning
// runs. There is a slight chance of a race between pruning and the
// Put and Get calls, but systems using the HealthCheck will just retry
// and succeed the next time.
err := s.Put(ctx, testData /* start of epoch */, 0)
if err != nil {
return err
}
Expand Down

0 comments on commit 903c937

Please sign in to comment.