You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using agenda job, to trigger a request with some payload as follows:
exports.addJob = catchAsync(async(req, res, next) => {
var requestBody = req.body;
var user = requestBody.user;
var scheduledTime = new Date(requestBody.scheduledTime).toUTCString();
var content = requestBody.content;
var hash = getEncryptedHash(user, scheduledTime);
agenda.define(hash, async (job) => {
try {
var postData = {
content: content,
currentUser: user
}
var postUrl = `${process.env.DOMAIN}/api/v1/min-mum` + '/create-post';
var payload = {
url: postUrl,
method: 'POST',
data: postData,
headers: {
'Content-Type': 'application/json',
}
};
await axios(payload);
} catch(err) {
console.log(err);
}
});
await startAgenda(hash, scheduledTime);
})
As you can see, I am saving the content and the scheduled time as submitted by the user,
Now the user can update the schedule as well, how do I update the existing job in this case? Is there a way to do this, or do I need to cancel this job and add another job?
I am using agenda job, to trigger a request with some payload as follows:
As you can see, I am saving the content and the scheduled time as submitted by the user,
Now the user can update the schedule as well, how do I update the existing job in this case? Is there a way to do this, or do I need to cancel this job and add another job?
@loris @mwbrooks @dawnerd @joeframbach @dandv
The text was updated successfully, but these errors were encountered: