Skip to content

Commit

Permalink
if no disk or memory specified, do not add these parameters when crea…
Browse files Browse the repository at this point in the history
…ting a job
  • Loading branch information
metskem committed Oct 14, 2024
1 parent a20120d commit 088491f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cron/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ func DoJob(scheduledTime time.Time, job model.SchedulableJob) {
historyRecord := model.History{Guid: util.GenerateGUID(), ScheduledTime: scheduledTime, ExecutionStartTime: time.Now(), ScheduleGuid: job.ScheduleGuid, CreatedAt: time.Now()}

// run the actual cf task
taskCreateRequest := resource.TaskCreate{Command: &job.Command, MemoryInMB: &job.MemoryInMB, DiskInMB: &job.DiskInMB}
taskCreateRequest := resource.TaskCreate{Command: &job.Command}
if job.MemoryInMB > 0 {
taskCreateRequest.MemoryInMB = &job.MemoryInMB
}
if job.DiskInMB > 0 {
taskCreateRequest.DiskInMB = &job.DiskInMB
}
if task, err := conf.CfClient.Tasks.Create(conf.CfCtx, job.AppGuid, &taskCreateRequest); err != nil {
fmt.Printf("failed running cmd %s in app with guid %s: %s\n", job.Command, job.AppGuid, err)
} else {
Expand Down

0 comments on commit 088491f

Please sign in to comment.