Set a different ID on the same function job, which runs at startup and ensure both functions are run. See next test for behaviour without setting job_id.
(worker)
| 254 | |
| 255 | |
| 256 | async def test_job_same_function_different_id(worker): |
| 257 | """ |
| 258 | Set a different ID on the same function job, which runs at startup and ensure both functions are run. |
| 259 | See next test for behaviour without setting job_id. |
| 260 | """ |
| 261 | worker: Worker = worker( |
| 262 | cron_jobs=[ |
| 263 | cron(foobar, minute=10, run_at_startup=True, job_id='custom_id'), |
| 264 | cron(foobar, minute=20, run_at_startup=True, job_id='custom_id2'), |
| 265 | ], |
| 266 | poll_delay=0.01, |
| 267 | ) |
| 268 | await worker.main() |
| 269 | |
| 270 | assert worker.jobs_complete == 2 |
| 271 | assert worker.jobs_failed == 0 |
| 272 | assert worker.jobs_retried == 0 |
| 273 | |
| 274 | |
| 275 | async def test_run_at_startup_no_id_only_runs_once(worker): |