Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 2b39b04

Browse files
committed
update recursively only for failed or canceled compute_plan
1 parent 8d86d68 commit 2b39b04

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

chaincode/traintuple.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,17 @@ func UpdateTraintupleChildren(db *LedgerDB, traintupleKey string, traintupleStat
499499
return fmt.Errorf("Unknown child traintuple type: %s", child.AssetType)
500500
}
501501

502-
// Recursively call for an update on this child's children
503-
err = UpdateTesttupleChildren(db, childTraintupleKey, childTraintupleStatus)
504-
if err != nil {
505-
return err
502+
if stringInSlice(traintupleStatus, []string{StatusFailed, StatusCanceled}) {
503+
// Recursively call for an update on this child's children
504+
err = UpdateTesttupleChildren(db, childTraintupleKey, childTraintupleStatus)
505+
if err != nil {
506+
return err
507+
}
508+
509+
err = UpdateTraintupleChildren(db, childTraintupleKey, childTraintupleStatus)
510+
if err != nil {
511+
return err
512+
}
506513
}
507514
}
508515
return nil

0 commit comments

Comments
 (0)