Skip to content

Commit

Permalink
Merge pull request #337 from Pchelolo/warn_old_jobs_delayed
Browse files Browse the repository at this point in the history
Take event delay into account when warning about long pickup
  • Loading branch information
clarakosi committed Feb 11, 2020
2 parents 0185252 + 201cfd7 commit ecbe351
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/base_executor.js
Expand Up @@ -411,8 +411,7 @@ class BaseExecutor {

if (origEvent.delay_until && !this.disable_delayed_execution) {
// The delay_until in the job schema is a timestamps in seconds
// TODO: Suppport both ISO 8601 and mediawiki date formats. Remove after transition.
const delayUntil = Date.parse(origEvent.delay_until) || origEvent.delay_until * 1000;
const delayUntil = Date.parse(origEvent.delay_until);
const now = Date.now();
if (delayUntil > Date.now()) {
const timeLeft = delayUntil - now;
Expand Down Expand Up @@ -457,7 +456,7 @@ class BaseExecutor {
}));

const metricStartTime = statDelayStartTime || new Date(origEvent.meta.dt);
if (Date.now() - metricStartTime > 86400000) {
if (Date.now() - (Date.parse(origEvent.delay_until) || metricStartTime) > 86400000) {
// Log a warning for jobs that has more then 1 day normal delay
// Note: this is not the root-event delay, just normal delay.
this._logger.log('warn/oldevent', () => ({
Expand Down

0 comments on commit ecbe351

Please sign in to comment.