Skip to content

Commit

Permalink
include interval bypass even if metadata is requested
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed Jun 18, 2021
1 parent ded6f40 commit 32179ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/manager.js
Expand Up @@ -185,14 +185,14 @@ class Manager extends EventEmitter {
let result

if (batchSize) {
const maxExpiration = jobs.reduce((acc, i) => Math.max(acc, i.expirein), 0)
const maxExpiration = jobs.reduce((acc, i) => Math.max(acc, i.expire_in_seconds), 0)

// Failing will fail all fetched jobs
result = await resolveWithinSeconds(Promise.all([callback(jobs)]), maxExpiration)
.catch(err => this.fail(jobs.map(job => job.id), err))
} else {
result = await pMap(jobs, job =>
resolveWithinSeconds(callback(job), job.expirein)
resolveWithinSeconds(callback(job), job.expire_in_seconds)
.then(result => this.complete(job.id, result))
.catch(err => this.fail(job.id, err))
, { concurrency: teamConcurrency }
Expand Down
2 changes: 1 addition & 1 deletion src/plans.js
Expand Up @@ -324,7 +324,7 @@ function fetchNextJob (schema) {
retryCount = CASE WHEN state = '${states.retry}' THEN retryCount + 1 ELSE retryCount END
FROM nextJob
WHERE j.id = nextJob.id
RETURNING ${includeMetadata ? 'j.*' : 'j.id, name, data, EXTRACT(epoch FROM expireIn) as expireIn'}
RETURNING ${includeMetadata ? 'j.*' : 'j.id, name, data'}, EXTRACT(epoch FROM expireIn) as expire_in_seconds
`
}

Expand Down

0 comments on commit 32179ee

Please sign in to comment.