File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1092,18 +1092,16 @@ func (mtask *managedTask) time() ttime.Time {
1092
1092
1093
1093
func (mtask * managedTask ) cleanupTask (taskStoppedDuration time.Duration ) {
1094
1094
cleanupTimeDuration := mtask .GetKnownStatusTime ().Add (taskStoppedDuration ).Sub (ttime .Now ())
1095
- // There is a potential deadlock here if cleanupTime is negative. Ignore the computed
1096
- // value in this case in favor of the default config value.
1095
+ cleanupTime := make (<- chan time.Time )
1097
1096
if cleanupTimeDuration < 0 {
1098
- seelog .Infof ("Managed task [%s]: Cleanup Duration is too short. Resetting to: %s" ,
1099
- mtask .Arn , config .DefaultTaskCleanupWaitDuration .String ())
1100
- cleanupTimeDuration = config .DefaultTaskCleanupWaitDuration
1097
+ seelog .Infof ("Managed task [%s]: Cleanup Duration has been exceeded. Starting cleanup now " , mtask .Arn )
1098
+ cleanupTime = mtask .time ().After (time .Nanosecond )
1099
+ } else {
1100
+ cleanupTime = mtask .time ().After (cleanupTimeDuration )
1101
1101
}
1102
- cleanupTime := mtask .time ().After (cleanupTimeDuration )
1103
1102
cleanupTimeBool := make (chan struct {})
1104
1103
go func () {
1105
1104
<- cleanupTime
1106
- cleanupTimeBool <- struct {}{}
1107
1105
close (cleanupTimeBool )
1108
1106
}()
1109
1107
// wait for the cleanup time to elapse, signalled by cleanupTimeBool
You can’t perform that action at this time.
0 commit comments