File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1616def scheduler_loop (
1717 func : ScheduledWorkflow , cron : str , stop_event : threading .Event
1818) -> None :
19- iter = croniter (cron , datetime .now (timezone .utc ))
19+ iter = croniter (cron , datetime .now (timezone .utc ), second_at_beginning = True )
2020 while not stop_event .is_set ():
2121 nextExecTime = iter .get_next (datetime )
2222 sleepTime = nextExecTime - datetime .now (timezone .utc )
Original file line number Diff line number Diff line change 99def test_scheduled_workflow (dbos : DBOS ) -> None :
1010 wf_counter : int = 0
1111
12- @DBOS .scheduled ("* * * * * *" )
12+ @DBOS .scheduled ("*/2 * * * * *" )
1313 @DBOS .workflow ()
1414 def test_workflow (scheduled : datetime , actual : datetime ) -> None :
1515 nonlocal wf_counter
1616 wf_counter += 1
1717
18- time .sleep (2 )
19- assert wf_counter >= 1 and wf_counter <= 3
18+ time .sleep (4 )
19+ assert wf_counter > 1 and wf_counter <= 3
2020
2121
2222def test_scheduled_workflow_exception (dbos : DBOS ) -> None :
You can’t perform that action at this time.
0 commit comments