dbader / dbader/schedule

the time of job needed will be count for every ?

Open
#616 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12.3k
Forks
999
PR merge metrics
No merged PRs in 30d

Description

```python
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

```shell
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 ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example using schedule.every(2).minutes.do(job), schedule.run_pending(), and the 30-second sleep, then inspect how the scheduled job is run and rescheduled. Confirm whether the documented behavior should include job execution time; done means the timing semantics are clarified or the observed interval is corrected and verified against the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.