Menu

Post image 1
Post image 2
1 / 2
0

Scheduling Posts Exactly On Time With QStash + Next.js

DEV Community·Nicolas Lecocq·23 days ago
#sbitL8mP
#nextjs#vercel#qstash#time#publish#cron
Reading 0:00
15s threshold

I needed to schedule LinkedIn posts to publish at exact times chosen by users. Vercel cron supports cron expressions, so I figured I would run a job every minute and check if any post should publish in the next minute. That works. It is also wasteful, fires a function 1,440 times a day, and on free Vercel plans you only get a 1-minute resolution which is not exact. I switched to Upstash QStash. Same family as Redis, separate product, designed for delayed and scheduled HTTP requests. The setup ended up cleaner than the cron approach and runs at the exact second. What QStash actually does You publish a message to QStash with a target URL and a delay or cron expression. QStash sits on the message until the time is right, then makes an HTTP POST to your URL with whatever body you set. It signs the request so you can verify it came from QStash. For one-off scheduling, you publish once with a delay or notBefore parameter. For recurring jobs, you create a schedule with a cron expression.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More