fix: retire cron containers past their active deadline
Cron containers were never reaped once they exceeded their active deadline, so a hung cron task ran indefinitely instead of being retired after 24 hours as documented. `cron:run` now also accepts a `--ttl-seconds` argument, matching the one `dokku run` already takes.
This commit is contained in:
@@ -21,7 +21,7 @@ Additional commands:`
|
||||
cron:list <app> [--format json|stdout], List scheduled cron tasks for an app
|
||||
cron:report [<app>] [<flag>], Display report about an app
|
||||
cron:resume <app> <cron_id>, Resume a cron task
|
||||
cron:run <app> <cron_id> [--detach], Run a cron task on the fly
|
||||
cron:run <app> <cron_id> [--detach] [--ttl-seconds SECONDS], Run a cron task on the fly
|
||||
cron:set [--global|<app>] <key> <value>, Set or clear a cron property for an app
|
||||
cron:suspend <app> <cron_id>, Suspend a cron task`
|
||||
)
|
||||
|
||||
@@ -49,10 +49,11 @@ func main() {
|
||||
case "run":
|
||||
args := flag.NewFlagSet("cron:run", flag.ExitOnError)
|
||||
detached := args.Bool("detach", false, "--detach: run the container in a detached mode")
|
||||
ttlSeconds := args.Int64("ttl-seconds", cron.DefaultTTLSeconds, "--ttl-seconds: number of seconds the task may run before it is reaped")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
cronID := args.Arg(1)
|
||||
err = cron.CommandRun(appName, cronID, *detached)
|
||||
err = cron.CommandRun(appName, cronID, *detached, *ttlSeconds)
|
||||
case "set":
|
||||
args := flag.NewFlagSet("cron:set", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: set a global property")
|
||||
|
||||
Reference in New Issue
Block a user