timgit/pg-boss

Scheduling many individual jobs for the same queue

jpike88 opened this issue · 3 comments

Hello,

I same to have a problem understanding the documentation.

This code:

await boss.schedule(
		'my_queue_name',
                '0 8 * * *', // queue for 8am
		{
			// some data here
		},
		{
			tz: 'Australia/Sydney',
		}
	);

I want run it hundreds of times throughout the day but when I test this, I just see the one row in the schedule table, it's like I can only schedule one job per queue at any given time?

timgit commented

That's correct. schedule() overwrites any previous schedule for the specified queue.

Do you have a recommendation for the pattern I should use? I'm trying to use pgboss to defer notifications generated during the night to be picked up and sent in the morning.

timgit commented

You can use the startAfter property to schedule jobs.