I am using the Firebase service for the project. We have a requirement that a user can schedule tasks for specific times. For example Jan 30th at 2 PM, Feb 2nd at 3 PM, and N. On the particular date and time, the scheduler must fire up and do the logic and have to delete without recurrence. To achieve this, I have explored the firebase services and found firebase scheduler functions that can be scheduled with unix-corn string format.
So each schedule I am creating a new scheduler function with every onWrite
function event. So there will be a couple of scheduler function trigger for completing specific jobs. For example, one of the scheduler functions will trigger on Jan 30th at 2 PM and complete the task and have to delete that Jan at 2 PM scheduler function to prevent recurrence in the future.
I can do scheduling and all but couldn't find a way to delete that particular function other than the shell command firebase functions:delete scheduledFunction
. Is there any way to delete the schedule function programmatically?
I have found an option to delete the pub-sub topic. Will pub-sub topic delete do a complete delete of the schedule function? also, it seems it's not part of the firebase admin SDK!
Cloud Tasks are ideal for creating such dynamic schedules. When a user schedules a task, you can add a Cloud Task that'll call your Cloud Function (or any API) at the given time once.
Also checkout: