@@ -61,7 +61,7 @@ type TaskStoreInterface interface {
6161 ListTasks (filterContext * model.FilterContext , opts * list.Options ) ([]* model.Task , int , string , error )
6262
6363 // Creates new tasks or updates the existing ones.
64- CreateOrUpdateTasks (tasks []* model.Task ) ([]* model.Task , error )
64+ CreateOrUpdateTasks (tasks []* model.Task , runID string ) ([]* model.Task , error )
6565}
6666
6767type TaskStore struct {
@@ -324,15 +324,15 @@ func (s *TaskStore) GetTask(id string) (*model.Task, error) {
324324}
325325
326326// Updates missing fields with existing data entries.
327- func (s * TaskStore ) patchWithExistingTasks (tasks []* model.Task ) error {
327+ func (s * TaskStore ) patchWithExistingTasks (tasks []* model.Task , runID string ) error {
328328 var podNames []string
329329 for _ , task := range tasks {
330330 podNames = append (podNames , task .PodName )
331331 }
332332 sql , args , err := sq .
333333 Select (taskColumns ... ).
334334 From ("tasks" ).
335- Where (sq.Eq {"PodName" : podNames }).
335+ Where (sq.Eq {"PodName" : podNames , "RunUUID" : runID }).
336336 ToSql ()
337337 if err != nil {
338338 return util .NewInternalServerError (err , "Failed to create query to check existing tasks" )
@@ -359,7 +359,7 @@ func (s *TaskStore) patchWithExistingTasks(tasks []*model.Task) error {
359359}
360360
361361// Creates new entries or updates existing ones.
362- func (s * TaskStore ) CreateOrUpdateTasks (tasks []* model.Task ) ([]* model.Task , error ) {
362+ func (s * TaskStore ) CreateOrUpdateTasks (tasks []* model.Task , runID string ) ([]* model.Task , error ) {
363363 buildQuery := func (ts []* model.Task ) (string , []interface {}, error ) {
364364 sqlInsert := sq .Insert ("tasks" ).Columns (taskColumnsWithPayload ... )
365365 for _ , t := range ts {
@@ -405,7 +405,7 @@ func (s *TaskStore) CreateOrUpdateTasks(tasks []*model.Task) ([]*model.Task, err
405405
406406 // Check for existing tasks and fill empty field with existing data.
407407 // Assumes that PodName column is a unique key.
408- if err := s .patchWithExistingTasks (tasks ); err != nil {
408+ if err := s .patchWithExistingTasks (tasks , runID ); err != nil {
409409 return nil , util .NewInternalServerError (err , "Failed to check for existing tasks" )
410410 }
411411 for _ , task := range tasks {
0 commit comments