fix: ensure the concurrency policy is propagated when running a cron command directly

This commit is contained in:
Jose Diaz-Gonzalez
2025-11-13 01:53:33 -05:00
parent c56110b3a7
commit 3f8c868ab8

View File

@@ -112,9 +112,11 @@ func CommandRun(appName string, cronID string, detached bool) error {
} }
command := "" command := ""
concurrencyPolicy := "allow"
for _, task := range tasks { for _, task := range tasks {
if task.ID == cronID { if task.ID == cronID {
command = task.Command command = task.Command
concurrencyPolicy = task.ConcurrencyPolicy
} }
} }
@@ -134,6 +136,7 @@ func CommandRun(appName string, cronID string, detached bool) error {
os.Setenv("DOKKU_DISABLE_TTY", "true") os.Setenv("DOKKU_DISABLE_TTY", "true")
} }
os.Setenv("DOKKU_CONCURRENCY_POLICY", concurrencyPolicy)
os.Setenv("DOKKU_CRON_ID", cronID) os.Setenv("DOKKU_CRON_ID", cronID)
os.Setenv("DOKKU_RM_CONTAINER", "1") os.Setenv("DOKKU_RM_CONTAINER", "1")
scheduler := common.GetAppScheduler(appName) scheduler := common.GetAppScheduler(appName)