APScheduler interval is not executed immediately.

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

< H1 > Why does start not run job1, once and then wait 5 seconds, but wait 5 seconds before running job1? < / H1 >

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

Jun.24,2021

scheduler.add_job (job1, 'interval', seconds=5, next_run_time=datetime.datetime.now ())


scheduler.add_job (job1,' interval', seconds=5, next_run_time=datetime.datetime.now ())
@ Joyyu Thank you

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5f24d-45801.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5f24d-45801.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?