scheduler_replay does not return the task id anymore but uses a reference to store the id to avoid problems when the id is used inside the callback.