Skip to content

Commit 6e67150

Browse files
Arta AsadiArta Asadi
authored andcommitted
fix: update task run scheduler migrator
1 parent 98b9e8e commit 6e67150

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

jobs/post-install-job/job/migrations/tasks/migrator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func (m Migration) Run(ctx context.Context, conf config.MigratorConfig, logger *
187187
}
188188

189189
if err = dbm.ORM.Create(&models.TaskRunSchedule{
190+
ID: runSchedule.ID,
190191
TaskID: task.ID,
191192
Params: paramsJsonb,
192193
Frequency: frequencyFloat,

services/tasks/db/models/task.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ type TaskConfigSecret struct {
4545
}
4646

4747
type TaskRunSchedule struct {
48-
SchedulerID string `gorm:"primarykey"`
49-
TaskID string `gorm:"primarykey"`
50-
Params pgtype.JSONB
51-
Frequency float64
48+
ID string `gorm:"primarykey"`
49+
TaskID string `gorm:"primarykey"`
50+
Params pgtype.JSONB
51+
Frequency float64
5252
}

services/tasks/scheduler/create_task.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (s *MainScheduler) createTasks(ctx context.Context) error {
4040
return err
4141
}
4242
for _, runSchedule := range runSchedules {
43-
lastRun, err := s.db.FetchLastTaskRunsByTaskSchedulerID(task.ID, runSchedule.SchedulerID)
43+
lastRun, err := s.db.FetchLastTaskRunsByTaskSchedulerID(task.ID, runSchedule.ID)
4444
if err != nil {
4545
return err
4646
}
@@ -54,7 +54,7 @@ func (s *MainScheduler) createTasks(ctx context.Context) error {
5454
TaskID: task.ID,
5555
Status: models.TaskRunStatusCreated,
5656
TriggerType: models.TriggerTypeScheduled,
57-
TriggeredBy: runSchedule.SchedulerID,
57+
TriggeredBy: runSchedule.ID,
5858
}
5959

6060
err = newRun.Result.Set([]byte("{}"))

services/tasks/worker/model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Interval struct {
2929
}
3030

3131
type TaskRunSchedule struct {
32+
ID string `yaml:"id"`
3233
Params map[string]any `yaml:"params"`
3334
Frequency string `yaml:"frequency"`
3435
}

0 commit comments

Comments
 (0)