8000 Options are not passed correct when scheduling jobs by janmeier · Pull Request #523 · timgit/pg-boss · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Options are not passed correct when scheduling jobs #523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/timekeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Timekeeper extends EventEmitter {
const scheduled = schedules
.filter(i => this.shouldSendIt(i.cron, i.timezone))
.map(({ name, data, options }) =>
({ name: QUEUES.SEND_IT, data: { name, data, options }, singletonKey: name, singletonSeconds: 60 }))
({ name: QUEUES.SEND_IT, data: { name, data, ...options }, singletonKey: name, singletonSeconds: 60 }))

if (scheduled.length > 0 && !this.stopped) {
await this.manager.insert(scheduled)
Expand Down
27 changes: 27 additions & 0 deletions test/scheduleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@ describe('schedule', function () {
await boss.stop({ graceful: false })
})

it('should set job metadata correctly', async function () {
const config = {
...this.test.bossConfig,
cronMonitorIntervalSeconds: 1,
cronWorkerIntervalSeconds: 1,
noDefault: true
}

let boss = await helper.start(config)
const queue = this.test.bossConfig.schema

await boss.createQueue(queue)
await boss.schedule(queue, '* * * * *', {}, { retryLimit: 42 })
await boss.stop({ graceful: false })

boss = await helper.start({ ...config, schedule: true })

await delay(2000)

const [job] = await boss.fetch(queue, { includeMetadata: true })

assert(job)

assert.strictEqual(job.retryLimit, 42)
await boss.stop({ graceful: false })
})

it('should not enable scheduling if archive config is < 60s', async function () {
const config = {
...this.test.bossConfig,
Expand Down
Loading
0