@@ -94,9 +94,9 @@ type workerJob struct {
9494}
9595
9696type scheduledJob struct {
97- Command * string `help:"Command to execute to start the scheduled job." placeholder:"\"bundle exec sidekiq \""`
97+ Command * string `help:"Command to execute to start the scheduled job." placeholder:"\"bundle exec rails runner \""`
9898 Name * string `help:"Name of the scheduled job job to add." placeholder:"scheduled-1"`
99- Size * string `help:"Size of the scheduled (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
99+ Size * string `help:"Size (resources) of the scheduled job (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
100100 Schedule * string `help:"Cron notation string for the scheduled job (defaults to \"* * * * *\")." placeholder:"* * * * *"`
101101}
102102
@@ -312,29 +312,26 @@ func (job workerJob) applyUpdates(cfg *apps.Config) {
312312 if job .Name == nil {
313313 return
314314 }
315- found := false
316315 for i := range cfg .WorkerJobs {
317316 if cfg .WorkerJobs [i ].Name == * job .Name {
318- found = true
319317 if job .Command != nil {
320318 cfg .WorkerJobs [i ].Command = * job .Command
321319 }
322320 if job .Size != nil {
323321 cfg .WorkerJobs [i ].Size = ptr .To (apps .ApplicationSize (* job .Size ))
324322 }
323+ return
325324 }
326325 }
327326
328- if ! found {
329- newJob := apps.WorkerJob {Job : apps.Job {Name : * job .Name }}
330- if job .Command != nil {
331- newJob .Command = * job .Command
332- }
333- if job .Size != nil {
334- newJob .Size = ptr .To (apps .ApplicationSize (* job .Size ))
335- }
336- cfg .WorkerJobs = append (cfg .WorkerJobs , newJob )
327+ newJob := apps.WorkerJob {Job : apps.Job {Name : * job .Name }}
328+ if job .Command != nil {
329+ newJob .Command = * job .Command
330+ }
331+ if job .Size != nil {
332+ newJob .Size = ptr .To (apps .ApplicationSize (* job .Size ))
337333 }
334+ cfg .WorkerJobs = append (cfg .WorkerJobs , newJob )
338335}
339336
340337func deleteWorkerJob (name string , cfg * apps.Config ) {
@@ -352,16 +349,13 @@ func deleteWorkerJob(name string, cfg *apps.Config) {
352349}
353350
354351func (job scheduledJob ) applyUpdates (cfg * apps.Config ) {
355- if (job .Command != nil || job .Size != nil ) && job .Name == nil {
356- format .PrintWarningf ("you need to pass a job name to update the command or size\n " )
357- }
358352 if job .Name == nil {
353+ format .PrintWarningf ("you need to pass a job name to update the command, schedule or size\n " )
359354 return
360355 }
361- found := false
356+
362357 for i := range cfg .ScheduledJobs {
363358 if cfg .ScheduledJobs [i ].Name == * job .Name {
364- found = true
365359 if job .Command != nil {
366360 cfg .ScheduledJobs [i ].Command = * job .Command
367361 }
@@ -371,19 +365,18 @@ func (job scheduledJob) applyUpdates(cfg *apps.Config) {
371365 if job .Schedule != nil {
372366 cfg .ScheduledJobs [i ].Schedule = * job .Schedule
373367 }
368+ return
374369 }
375370 }
376371
377- if ! found {
378- newJob := apps.ScheduledJob {Job : apps.Job {Name : * job .Name }}
379- if job .Command != nil {
380- newJob .Command = * job .Command
381- }
382- if job .Size != nil {
383- newJob .Size = ptr .To (apps .ApplicationSize (* job .Size ))
384- }
385- cfg .ScheduledJobs = append (cfg .ScheduledJobs , newJob )
372+ newJob := apps.ScheduledJob {Job : apps.Job {Name : * job .Name }}
373+ if job .Command != nil {
374+ newJob .Command = * job .Command
375+ }
376+ if job .Size != nil {
377+ newJob .Size = ptr .To (apps .ApplicationSize (* job .Size ))
386378 }
379+ cfg .ScheduledJobs = append (cfg .ScheduledJobs , newJob )
387380}
388381
389382func deleteScheduledJob (name string , cfg * apps.Config ) {
0 commit comments