bunkat / later

A javascript library for defining recurring schedules and calculating future (or past) occurrences for them. Includes support for using English phrases and Cron schedules. Works in Node and in the browser.
http://bunkat.github.io/later/
MIT License
2.42k stars 244 forks source link

dynamic tasks consult #202

Open willin opened 7 years ago

willin commented 7 years ago

i have a Business Scenario like this

users.forEach(async (x) => {
  await updateUserInfo(x);
  later.setInterval(async () => {
    await updateUserInfo(x);
  }, later.parse.recur().every(random(50, 70)).second());
});

update each user status info every 50-70s.(Worry about performance if all tasks are 60s)

Questions:

  1. if there is a new user, how to startup a new task?
  2. if there a large amount of users (like 10k+), it's there a better way?