Home > Blockchain >  Github action cron scheduler runs on wrong hours
Github action cron scheduler runs on wrong hours

Time:09-13

I have created a github action with the following code, which is supposed to run every day at 1am:

on:
  schedule:
    - cron: '0 1 * * *'

jobs:
  update-stats:
    runs-on: ubuntu-latest
    steps:
        # code

It looks pretty straight forward to me. The action runs, but completely out of schedule.

Mon, 12 Sep 2022 03:48:58 GMT
Current runner version: '2.296.1'
Mon, 12 Sep 2022 03:48:58 GMT  Operating System
Mon, 12 Sep 2022 03:48:58 GMT  Ubuntu
Mon, 12 Sep 2022 03:48:58 GMT  20.04.5
Mon, 12 Sep 2022 03:48:58 GMT  LTS

Even if we take timezones in consideration, it is running at minute 48. How does it work?

CodePudding user response:

According to the schedule notes on Github Actions official documentation

Note: The schedule event can be delayed during periods of high loads of GitHub Actions workflow runs. High load times include the start of every hour. To decrease the chance of delay, schedule your workflow to run at a different time of the hour.


Moreover, In a discussion in the GitHub Support Community (No assurance on scheduled jobs?), Github partner @brightran said that many times, there may be a delay when triggering the scheduled workflow:

Generally, the delay time is about 3 to 10 minutes. Sometimes, it may be more, even dozens of minutes, or more than one hour.

He also explained that if the delay time is too long, the scheduled workflow may be not triggered at that day. Therefore, it's not recommended to use GitHub Actions scheduled workflows for production tasks that require execution guarantee.

Source

  • Related