Git Product home page Git Product logo

Comments (7)

fanlinzu avatar fanlinzu commented on July 4, 2024

默认是按重启时间和固定速率时间计算算下一次执行时间,如何考虑兼容考虑用崩溃前的最后一次执行时间和固定速率算出重启后的第一次执行时间。

from xxl-job.

fanlinzu avatar fanlinzu commented on July 4, 2024

问题描述:使用固定速率一小时,每隔一小时执行一次,比如第一次执行时间8:10,第二次执行时间9:10,然后在9:30的时候xxl-job重启,则该定时器的下一次执行时间会变为10:30;
需求:需要重启后的第一次执行时间为10:10

from xxl-job.

guohui-ma avatar guohui-ma commented on July 4, 2024

看这个需求,和现象。是需要在某个地方保存一下这个任务上一次执行的时间。

有两个问题:

  1. 如果中间停的时间超过了你的间隔1小时呢。
  2. 为什么不适用 cron表达式 10 * * * * 来表示呢?每小时的10分执行。

from xxl-job.

fanlinzu avatar fanlinzu commented on July 4, 2024

cron表达式不支持考虑开始时间的周期执行。比如在未来的某个时间点开始第一次执行,然后按照固定周期循环执行。

from xxl-job.

fanlinzu avatar fanlinzu commented on July 4, 2024

看这个需求,和现象。是需要在某个地方保存一下这个任务上一次执行的时间。

有两个问题:

  1. 如果中间停的时间超过了你的间隔1小时呢。
  2. 为什么不适用 cron表达式 10 * * * * 来表示呢?每小时的10分执行。

若中间停的时间超过间隔一个小时,比如10:10执行时间已经错过,那重启后第一次执行时间就是11:10

from xxl-job.

fanlinzu avatar fanlinzu commented on July 4, 2024

看这个需求,和现象。是需要在某个地方保存一下这个任务上一次执行的时间。

有两个问题:

  1. 如果中间停的时间超过了你的间隔1小时呢。
  2. 为什么不适用 cron表达式 10 * * * * 来表示呢?每小时的10分执行。

执行周期的单位可能为分钟,从某个时间开始,按照固定周期往后推,符合时间点就执行,所以考虑到cron表达式不支持。

from xxl-job.

AlanNiew avatar AlanNiew commented on July 4, 2024

可以记录一下上次执行成功的时间。

from xxl-job.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.