diff --git a/.env.example b/.env.example index 373eba9..09ce499 100644 --- a/.env.example +++ b/.env.example @@ -72,8 +72,9 @@ OIDC_USE_DISCOVERY=true YNAB_ACCESS_TOKEN=your-ynab-personal-access-token # Optional: Specify a budget ID, or leave empty to use the default/first budget YNAB_BUDGET_ID= -# Seconds between background YNAB delta syncs (agent tools also sync on demand) -YNAB_SYNC_INTERVAL=900 +# Seconds between background YNAB delta syncs. Keep under the agent tools' 120s +# freshness window so tools rarely wait on an inline YNAB fetch. +YNAB_SYNC_INTERVAL=90 # Mealie Configuration # Base URL for your Mealie instance (e.g., http://192.168.1.5:9000 or https://mealie.example.com) diff --git a/blueprints/ynab/sync.py b/blueprints/ynab/sync.py index 3ddb27e..b73e36c 100644 --- a/blueprints/ynab/sync.py +++ b/blueprints/ynab/sync.py @@ -630,7 +630,8 @@ async def ensure_fresh(max_age_seconds: int = 120) -> YnabSyncState | None: async def ynab_sync_loop() -> None: """Background task: delta-sync YNAB every ``YNAB_SYNC_INTERVAL`` seconds.""" - interval = int(os.getenv("YNAB_SYNC_INTERVAL", "900")) + # Below ensure_fresh's 120s window, so tool calls rarely sync inline. + interval = int(os.getenv("YNAB_SYNC_INTERVAL", "90")) logger.info(f"YNAB sync loop started (interval={interval}s)") while True: try: diff --git a/docker-compose.yml b/docker-compose.yml index 59bde2f..982aae3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ x-raggr-common: &raggr-common - TAVILY_API_KEY=${TAVILIY_API_KEY} - YNAB_ACCESS_TOKEN=${YNAB_ACCESS_TOKEN} - YNAB_BUDGET_ID=${YNAB_BUDGET_ID} - - YNAB_SYNC_INTERVAL=${YNAB_SYNC_INTERVAL:-900} + - YNAB_SYNC_INTERVAL=${YNAB_SYNC_INTERVAL:-90} - MEALIE_BASE_URL=${MEALIE_BASE_URL} - MEALIE_API_TOKEN=${MEALIE_API_TOKEN} - MEALIE_GROUP_SLUG=${MEALIE_GROUP_SLUG:-home}