Comment on page
Delay
To add a delay to your job, simply include a
delay
parameter in your request options. The delay
value should be in milliseconds.Here's an example of a job request with a delay of 1 second (1000 milliseconds):
import axios from 'axios';
axios.post('https://api.nextcron.co/v1/publish', {
"topic": "create-todo",
"target": "https://webhook.site/07e28015-5be9-465d-8621-86d360706317",
"method": "POST",
"data": {
"title": "foo",
"body": "bar",
"userId": 1
},
"options": {
"delay": 1000
}
}, {
headers: {
'X-NextCron-Token': "<insert_your_api_token>"
}
});
In this example, the job will be delayed by 1 second before being executed. This can be useful if you want to delay a job to allow time for other actions to complete first.
Remember that the
delay
value should be in milliseconds, so for a delay of 5 seconds, the value should be 5000
.Last modified 9mo ago