Skip to content

Commit

Permalink
feat(pruner): disabling availability window
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Nov 7, 2024
1 parent 66bb70f commit 0e7e8d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pruner/window.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pruner

import (
"os"
"time"
)

Expand All @@ -14,8 +15,14 @@ func (aw AvailabilityWindow) Duration() time.Duration {
// given AvailabilityWindow. If the window is disabled (0), it returns true for
// every timestamp.
func IsWithinAvailabilityWindow(t time.Time, window AvailabilityWindow) bool {
if alwaysAvailable {
return true
}
if window.Duration() == time.Duration(0) {
return true
}
return time.Since(t) <= window.Duration()
}

// alwaysAvailable is a flag that disables the availability window.
var alwaysAvailable = os.Getenv("CELESTIA_PRUNING_DISABLED") == "true"

0 comments on commit 0e7e8d1

Please sign in to comment.