Skip to content

Commit

Permalink
Merge 2699c85 into 76ae16c
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Feb 13, 2021
2 parents 76ae16c + 2699c85 commit fef40d3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions docs/multiple-schedulers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ However, for larger installations it might be desirable to have multiple schedul
This is supported:

.. code-block:: python
import time
import scheduler
import schedule
def fooJob():
print("Foo")
Expand All @@ -17,13 +16,19 @@ This is supported:
print("Bar")
# Create a new scheduler
scheduler1 = Scheduler()
scheduler1 = schedule.Scheduler()
# Add jobs to the created scheduler
scheduler1.every().hour.do(fooJob)
scheduler1.every().bar.do(barJob)
scheduler1.every().hour.do(barJob)
# Create as many schedulers as you need
scheduler2 = Scheduler()
scheduler2 = schedule.Scheduler()
scheduler2.every().second.do(fooJob)
scheduler2.every().second.do(barJob)
scheduler2.every().second.do(barJob)
while True:
# run_pending needs to be called on every scheduler
scheduler1.run_pending()
scheduler2.run_pending()
time.sleep(1)

0 comments on commit fef40d3

Please sign in to comment.