Task can not start from the rigth time

  1. When task was set to run every 4m, offset 25s at 2024-07-22 13:29:25, this task should run from 2024-07-22 13:33:25 in my mind.But this task started to run from 2024-07-22 13:32:25.


  2. So I tried to change the add 1m t offset param. task was set to run every 4m, offset 1m5s at 2024-07-22 13:42:05, then this task started to run at 2024-07-22 13:45:05 rather than 2024-07-22 13:46:05

How can the task start to run from the right timestamp?

@Leo, with the way the task scheduler works, schedules are not based on the “Created at” time. They are based on logical time increments relative to the Unix epoch. So a task that runs every 4 minutes will run at the following minutes in each hour:

  • HH:00
  • HH:04
  • HH:08
  • HH:12
  • HH:16
  • HH:20
  • HH:24
  • HH:28
  • HH:32
  • HH:36
  • HH:40
  • HH:44
  • HH:48
  • HH:52
  • HH:56

The offset delays the actual task execution, but, if you’re using relative time stamps to define your query range (-4m, -task.every), the task start time doesn’t affect the time range queried by the task.

Thanks for your reply.
If task in influxdb always execute from HH:00: 00, even if every is set to 1h, 1d?

Yes, correct. If a task is set to run every hour, it will run at the following times:

  • 00:00
  • 01:00
  • 02:00
  • 03:00
  • etc.

If set to run every day, it will run at 00:00 (midnight) every day. If you want the task to run at a specific time (other than midnight) and want the time range to be based on that time, you need to use the cron scheduling option, not the every scheduling option.

OK, Thank you for your reply