The keeper copies owner and waiting-on from the finding at raising (and into a condition kept from before G at its next change), hands a pipeline-failed to operator-channel after the setting owner-handover-seconds (default two hours, timed from the finding's since as a bound with its own time to live), says each change as the change owner, and the tool conditions_owner sets an owner now, written in the hand-act log. Builds: design 47 G §540, §685, §678, §557, A-58 (seed-waits: the indexer sets the finding's waiting-on; no kind rule here) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package main
|
|
|
|
// The bounds the keeper times are settings read at its start, their defaults the design's values, so a whole test sets
|
|
// them in seconds and never waits on real time (design 47 G §557).
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// The settings, in seconds.
|
|
const (
|
|
SettingAskBound = "ask-bound-seconds"
|
|
SettingViewWaits = "view-waits-seconds"
|
|
SettingHandover = "owner-handover-seconds"
|
|
defaultViewWaits = 5 * time.Minute
|
|
)
|
|
|
|
// seconds reads one setting as a duration; def when the setting is unreadable, absent or not above zero.
|
|
func seconds(read func(key string) (json.RawMessage, error), key string, def time.Duration) time.Duration {
|
|
raw, err := read(key)
|
|
if err != nil {
|
|
logf("the setting %s cannot be read (%v); its default %s stands", key, err, def)
|
|
return def
|
|
}
|
|
var n float64
|
|
if json.Unmarshal(raw, &n) != nil || n <= 0 {
|
|
return def
|
|
}
|
|
return time.Duration(n * float64(time.Second))
|
|
}
|
|
|
|
// ReadSettings sets the keeper's bounds and the first views' wait from the settings.
|
|
func ReadSettings(k *Keeper, read func(key string) (json.RawMessage, error)) (viewWaits time.Duration) {
|
|
k.AskBound = seconds(read, SettingAskBound, AskedWithin)
|
|
k.Handover = seconds(read, SettingHandover, OwnerHandover)
|
|
return seconds(read, SettingViewWaits, defaultViewWaits)
|
|
}
|