Merge pull request 'Sync YNAB in the background inside the tools' freshness window' (#74) from perf/ynab-sync-interval into main

This commit was merged in pull request #74.
This commit is contained in:
2026-10-12 23:06:35 -04:00
3 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -75,8 +75,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)
+2 -1
View File
@@ -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:
+1 -1
View File
@@ -25,7 +25,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}