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

Problem after each schedule, gets delayed even with Parallel execution #564

Open
pedrofaria09 opened this issue Feb 15, 2023 · 2 comments
Open

Comments

@pedrofaria09
Copy link

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
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 <Thread(Thread-196 (test), started 123145329221632)>
Current Time = 2023-02-15 21:03:10.999913 <Thread(Thread-197 (test), started 123145329221632)>
Current Time = 2023-02-15 21:03:12.000702 <Thread(Thread-198 (test), started 123145329221632)>
Current Time = 2023-02-15 21:03:13.002731 <Thread(Thread-199 (test), started 123145329221632)>

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)
@yxiao1996
Copy link

feel that it's working as expected:

  1. from this library's doc it mentions it's not supporting sub-second precision: https://schedule.readthedocs.io/en/stable/index.html
  2. I think your missed 2023-02-15 21:03:11 execution is actually 2023-02-15 21:03:10.999913

@ghost
Copy link

ghost commented Jul 3, 2023

feel that it's working as expected:

  1. from this library's doc it mentions it's not supporting sub-second precision: https://schedule.readthedocs.io/en/stable/index.html
  2. I think your missed 2023-02-15 21:03:11 execution is actually 2023-02-15 21:03:10.999913

Yep that would be the problem 😜

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

2 participants