I'd like to update a task that already exists.
As this doesn't seem to be possible, my current workaround is to remove a task if it already exists and recreate it with the new values.
Firstly I wonder why it's necessary to append "setTimeout" / "setInterval" to the task uid?
Wouldn't it be better to be able to access a task with the uid it was actually created with?
Alternatively it would be nice to maybe have something like an exposed generateUid method so that I don't have to append setTimeout manually (for the case this logic might change later)..
Secondly removing a task and recreating it within the same Meteor method doesn't work.
(I think it's what you mean with "Should be called in a separate event loop").
I guess I could trigger the same Meteor method after deleting the task, but I'm not sure if this would even work and it feels kinda error-prone..
const existingJob = job.collection.findOne({uid: `${taskId}setTimeout`});
if (existingJob) job.collection.remove({uid: `${taskId}setTimeout`});
...
job.setTimeout(task, diff, taskId)