summaryrefslogtreecommitdiff
path: root/internal/check.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-10-27 23:36:49 +0200
committerPaul Buetow <paul@buetow.org>2025-10-27 23:36:49 +0200
commit81d1550df55318beff8e9f762952a33daaa7c0cf (patch)
tree897e3c044c8e3bf5c9d71d98345fde9a645e8c7a /internal/check.go
parent6352e8c33c1c22af382093d406d477d1530950db (diff)
feat: Add randomSpread and RunInterval to checks
This commit introduces two new optional parameters to the check configuration: - `randomSpread`: This parameter allows specifying a random sleep time up to N seconds before a check is executed. This is useful to avoid all checks running at the same time. - `RunInterval`: This parameter defines the minimum interval in seconds between two executions of a check. This is useful if gogios is run more frequently than a specific check should be. The `README.md` has been updated to document these new features. fix: Fix deadlock when skipping checks This commit also fixes a deadlock that occurred when a check was skipped due to the `RunInterval` setting. The `inputWg.Done()` was not being called, causing the main goroutine to wait forever. build: Replace Taskfile with Magefile The `Taskfile.yml` has been replaced with a `Magefile.go` to manage the build process. This provides more flexibility and is more idiomatic for Go projects.
Diffstat (limited to 'internal/check.go')
-rw-r--r--internal/check.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/check.go b/internal/check.go
index 70f0044..3f2e4cc 100644
--- a/internal/check.go
+++ b/internal/check.go
@@ -14,6 +14,8 @@ type check struct {
DependsOn []string `json:"DependsOn,omitempty"`
Retries int `json:"Retries,omitempty"`
RetryInterval int `json:"RetryInterval,omitempty"`
+ RunInterval int `json:"RunInterval,omitempty"`
+ RandomSpread int `json:"RandomSpread,omitempty"`
}
type namedCheck struct {
@@ -65,4 +67,4 @@ func (c namedCheck) run(ctx context.Context) checkResult {
func (c namedCheck) skip(output string) checkResult {
return c.check.skip(c.name, output)
-}
+} \ No newline at end of file