Skip to content

perf: batch market cache refresh persistence - #25

Open
genaaredes-ui wants to merge 1 commit into
Dragoon4002:mainfrom
genaaredes-ui:codex/local-hub-cache-refresh
Open

perf: batch market cache refresh persistence#25
genaaredes-ui wants to merge 1 commit into
Dragoon4002:mainfrom
genaaredes-ui:codex/local-hub-cache-refresh

Conversation

@genaaredes-ui

Copy link
Copy Markdown

Summary

Batch the tracked market-cache refresh persistence into one database read and one commit, while keeping the rate-limited TwelveData fetches outside the database session.

Type

  • Bug fix
  • New strategy
  • New feature
  • Refactor
  • Documentation
  • Tests
  • Chore / dependency update

Related Issue

Closes #2

Changes

  • Fetch all tracked pairs before opening the database session.
  • Load existing rows with one composite-key query.
  • Apply updates/inserts and commit once.
  • Preserve skipped failed upstream fetches and empty-tracked behavior.

Testing

  • Python compileall for hub/
  • AST parse of hub/market/cache.py
  • git diff --check
  • Synthetic 32-pair benchmark: 32 queries/commits → 1 query/commit; 0.2765s → 0.0998s (~2.77x)
  • pytest tests/ passes locally (pytest is not installed in the execution environment)

Checklist

  • No secrets, API keys, or private keys committed
  • Type hints on all new public functions
  • Breaking changes documented in PR description

The persistence path is now measurably cheaper while upstream calls remain sequential to respect TwelveData rate limits.

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the dragoon4002's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvements Bounty: Performance Enhancer

1 participant