-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In #2893 we made more commands check for updates. Strictly not all of these checks are necessary as the code is unlikely to have changed regularly. Instead we should limit the amount we check for updates to (perhaps) once per day. Every time we perform an update check, we write the current time into update.json. Every time we run a command. if the current time is less than 24h after this value, don't do any checking. If the current time is 24h ahead of this value, do an update check.
- Loading branch information
Showing
4 changed files
with
97 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package util | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bacalhau-project/bacalhau/pkg/repo" | ||
"github.com/bacalhau-project/bacalhau/pkg/system" | ||
) | ||
|
||
type contextKey struct { | ||
name string | ||
} | ||
|
||
var ( | ||
SystemManagerKey = contextKey{name: "context key for storing the system manager"} | ||
FSRepoKey = contextKey{name: "context key for storing the filesystem-based repo"} | ||
) | ||
|
||
func GetCleanupManager(ctx context.Context) *system.CleanupManager { | ||
return ctx.Value(SystemManagerKey).(*system.CleanupManager) | ||
} | ||
|
||
func GetFSRepo(ctx context.Context) *repo.FsRepo { | ||
return ctx.Value(FSRepoKey).(*repo.FsRepo) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters