fix: honor live scheduling revisions at dispatch
This commit is contained in:
@@ -18,6 +18,7 @@ from wf_server.scheduling import (
|
||||
scheduler_lifespan,
|
||||
server_scheduler_config,
|
||||
)
|
||||
from wf_transport_rpc_http import create_rpc_app
|
||||
|
||||
|
||||
def test_server_scheduler_config_disabled_by_default() -> None:
|
||||
@@ -147,3 +148,25 @@ async def test_scheduler_lifespan_releases_lock_on_exit(tmp_path: Path) -> None:
|
||||
assert probe.held is True
|
||||
finally:
|
||||
probe.release()
|
||||
|
||||
|
||||
async def test_rpc_scheduler_lifespan_factory_starts_and_stops_service(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""The RPC app receives a callable that lazily owns scheduler startup."""
|
||||
server = build_local_static_workflow_server(tmp_path)
|
||||
config = SchedulerServiceConfig(auto_tick=False)
|
||||
app = create_rpc_app(
|
||||
server,
|
||||
lifespan=lambda _app: scheduler_lifespan(server, config),
|
||||
)
|
||||
|
||||
async with app.router.lifespan_context(app):
|
||||
assert server.api.schedules._schedule_store().root == tmp_path
|
||||
|
||||
probe = SchedulerOwnership(tmp_path, owner="probe")
|
||||
probe.acquire()
|
||||
try:
|
||||
assert probe.held is True
|
||||
finally:
|
||||
probe.release()
|
||||
|
||||
Reference in New Issue
Block a user