RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] New recurring scheduler return the same ids as previous tasks

juzser opened this issue · comments

What? ⛵

  • With scheduleOnce , the jobId will be returned differently each time (cause they're different tasks)
  • But with scheduleRecurring , the jobId will be returned the same every time you created a new task.
  • Then if you cancel by the id, all recurring jobs will be cancelled (because there is only one recurring record with that id)

Why? 🤔

In the database, the old recurring record will be overridden by the new one.

Links 🌎

Related to: #437

PS 👀

Expectation:

Each recurring task return separated id.

As I understand, with one schedule processor, only allow one recurring job, that makes sense.

But one processor with different data param, users should be able to trigger it in different interval.

Example:
Remind app with different messages data.
User can have multiple recurring reminders, with the same processor sendMessage.
And each reminder should stand by an id to be cancelled separately.

Update:
The scheduler should be kept as current. Close issue for now.

If someone want to build separated recurring schedules, you should repeat to creating another Once time scheduler inside process of previous one.
The ids will be different between each time you created the once time scheduler, so you should store the job in association records and then update the new id after create a repeat one.

I'm working on public & free reminder app here, that is not using recurring scheduler but have a feature to repeat the reminder: https://github.com/juzser/Rocket.Chat-reminder
If you guys need more information, I can help.