$data['failCount'] = $cronjob->failCount + 1;
// The cronjob exceeded the maximum fail count.
- // Thus it must be disabled.
- if ($data['failCount'] > Cronjob::MAX_FAIL_COUNT) {
+ // Cronjobs which can be disabled, should be disabled.
+ if ($cronjob->canBeDisabled && $data['failCount'] >= Cronjob::MAX_FAIL_COUNT) {
$data['isDisabled'] = 1;
$data['failCount'] = 0;
}
+ else if ($data['failCount'] >= Cronjob::MAX_FAIL_COUNT) {
+ // Reset failCount for cronjobs, which can't be disabled to
+ // MAX_FAIL_COUNT - 1, because the column has a max length
+ // which should not be reached.
+ $data['failCount'] = Cronjob::MAX_FAIL_COUNT - 1;
+ }
// fall through
case Cronjob::PENDING:
// The cronjob spent two periods in the PENDING state.