watchdog-long-running-automation-context

Status: IN

FTL2 automation contexts can be held open for hours in watchdog/monitoring loops. The context manages SSH connections and state for the lifetime of the `async with` block.

Source: repo:ftl2-servercraft/ftl2_servercraft/watchdog.py

Example

async with automation(
    state_file=str(config.state_path),
    fail_fast=True,
    quiet=True,
    auto_install_deps=True,
) as ftl:
    while state.watchdog_active:
        count = await script.get_player_count(ftl, config)
        # ... handle count, teardown on failures
        await asyncio.sleep(config.poll_interval)

JSON