Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the time of job needed will be count for every ? #616

Open
REBOOTERS opened this issue Mar 18, 2024 · 0 comments
Open

the time of job needed will be count for every ? #616

REBOOTERS opened this issue Mar 18, 2024 · 0 comments

Comments

@REBOOTERS
Copy link

def job():
    global count
    logger.info("I'm doing a periodic job!" + str(count))
    count = count + 1
    time.sleep(30)


# 每隔 2 分钟执行一次任务
job()
schedule.every(2).minutes.do(job)
while True:
    # logger.info("waiting for")
    schedule.run_pending()
    time.sleep(1)

the log is

2024-03-18 12:03:44,170 - INFO - I'm doing a periodic job!0
2024-03-18 12:06:14,534 - DEBUG - Running job Job(interval=2, unit=minutes, do=job, args=(), kwargs={})
2024-03-18 12:06:14,535 - INFO - I'm doing a periodic job!1
2024-03-18 12:08:44,888 - DEBUG - Running job Job(interval=2, unit=minutes, do=job, args=(), kwargs={})
2024-03-18 12:08:44,889 - INFO - I'm doing a periodic job!2
2024-03-18 12:11:15,267 - DEBUG - Running job Job(interval=2, unit=minutes, do=job, args=(), kwargs={})
2024-03-18 12:11:15,267 - INFO - I'm doing a periodic job!3
2024-03-18 12:13:45,660 - DEBUG - Running job Job(interval=2, unit=minutes, do=job, args=(), kwargs={})
2024-03-18 12:13:45,660 - INFO - I'm doing a periodic job!4

the code want job run every 2 minutes ,but it run every 2:30 minute , include the time the job costed.

Is this as expected? or Bug ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant