Problem after each schedule, gets delayed even with Parallel execution
- Dominant language
- Python
- Stars
- 12.3k
- Forks
- 999
- PR merge metrics
- No merged PRs in 30d
Description
Hello guys, I already searched and see many people are with problems because the schedule doesn't control the execution time, and the workaround for this is the Parallel execution: [here](https://schedule.readthedocs.io/en/stable/parallel-execution.html)
Even after trying this, I still have the problem and even missed one call on date: 2023-02-15 21:03:11
> Current Time = 2023-02-15 21:03:09.996591
Current Time = 2023-02-15 21:03:10.999913
Current Time = 2023-02-15 21:03:12.000702
Current Time = 2023-02-15 21:03:13.002731
Can someone help me with this? I would appreciate it so much.
my code:
```
import time
from datetime import datetime, timedelta
import threading
def test():
current_time = datetime.now()
print("Current Time =", current_time, threading.current_thread())
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
schedule.every(1).seconds.do(run_threaded, test)
if __name__ == "__main__":
while True:
schedule.run_pending()
time.sleep(1)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reported loop around schedule.run_pending(), run_threaded(), and time.sleep(1), then compare it with the linked Parallel execution documentation. Reproduce the missed interval using the shown timestamps and establish the expected scheduling behavior; done means the cause is confirmed and the behavior is covered by a clear explanation or regression test.
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
- Needs clarification
- Newbie friendliness
- 35/100