Skip to content

feat(distance): use plugin store for cache, budget #21

Closed

Description

@uniqueg

Follow-up of elixir-cloud-aai/foca#545. Blocked by elixir-cloud-aai/foca#550 and by a FOCA release that contains it.

Problem

tes.routing.distance caches geolocations per process (TtlCache), and with its opt-in dbip provider it can't cap lookups per user. Users who submit many tasks can use up DB-IP's free daily quota (500 requests); distance routing then stops applying until the quota resets.

Proposal

  • Use ctx.store (FOCA plugin store) for the geolocation cache instead of the per-process TtlCache, so all workers and replicas share it.
  • Add a per-user daily DB-IP budget with ctx.store.increment(key, ttl=86400, limit=n) (fixed window), keyed by a hash of the principal, never the raw user id; n configurable.
  • Declare data_stored (once available) and update the plugin docs.
  • Bump the FOCA requirement to the release that contains the store.

Done when

  • the plugin uses the shared store for its cache and budget, documented and tested (100% coverage).

Activity

  1. added
    priority: low
    status: blocked
    on Oct 28, 2026
  2. added
    type: feature
    workload: hours
    on Oct 28, 2026
  3. added
    status: triage
    status: in progress
    and removed
    status: blocked
    status: triage
    on Nov 9, 2026
  4. self-assigned this
    on Nov 13, 2026
  5. added a commit that references this issue on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: lowstatus: in progresstype: featureworkload: hours

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions