topic description
python APScheduler interval is not executed immediately
sources of topics and their own ideas
want to use APScheduler as a crawler that executes at intervals, so use the "interval" method to control it. It"s OK to run, but why wait for the interval before execution, instead of executing once and then waiting for the interval
.related codes
/ / Please paste the code text below (do not replace the code with pictures)
from apscheduler.schedulers.background import BlockingScheduler
import time
def job1 ():
print("job1",time.time())
scheduler = BlockingScheduler ()-sharp instantiate a scheduler
scheduler.add_job (job1, "interval", seconds=5)-sharp runs
print every 5 seconds ("main program start time:", time.time ())
scheduler.start ()-sharp scheduler calls job1
what result do you expect? What is the error message actually seen?
execution result:
main program start time: 1536570762.8778827
job1 start time 1536570767.878894
Why not run job1 first and then wait? is there any parameter that can be set