@@ 100,7 100,23 @@ func (ctx *JobContext) Settle() error {
settleTimer := prometheus.NewTimer(settleTime.WithLabelValues(ctx.Manifest.Image, arch))
defer settleTimer.ObserveDuration()
- timeout, cancel := context.WithTimeout(ctx.Context, 120*time.Second)
+ var (
+ ok bool
+ err error
+ startupTimeout int
+ startupTimeoutRaw string
+ )
+ // assumes the timeout is specified as an int in seconds
+ // e.g. 120 for 2 minutes
+ if startupTimeoutRaw, ok = config.Get("builds.sr.ht::worker", "startup-timeout"); !ok {
+ // default to old hardcoded value if the key wasn't found in the config file
+ startupTimeoutRaw = "120"
+ }
+ if startupTimeout, err = strconv.Atoi(startupTimeoutRaw); err != nil {
+ return errors.New("The startup-timeout could not be read")
+ }
+
+ timeout, cancel := context.WithTimeout(ctx.Context, time.Duration(startupTimeout)*time.Second)
defer cancel()
done := make(chan error, 1)
attempt := 0