Skip to content

Make the bulk import rate limit (5/hour per user) adjustable by an admin #1638

Backlog

Description

@camiracode

Problem
Every bulk import shares one import: rate bucket that is hardcoded to 5 imports per hour per user (src/app/api/import/route.ts, src/app/api/import/csv/route.ts, src/lib/import/record-import-route.ts). On a self-hosted server, a household member who is retrying or splitting a CSV gets "Too many imports this hour (limit 5)" and has to wait an hour. The only workaround is deleting their row from rate_limits by hand.

Request
Let a server admin change that limit, for example with an admin setting or an environment variable such as IMPORT_RATE_LIMIT_PER_HOUR. That would match the existing INSIGHTS_RATE_LIMIT_PER_HOUR. Keep the default at 5 so nothing changes unless an admin opts in.

Nice to have

  • An admin action to reset one user's import counter.
  • The limit shown in the rate-limit message and the API docs, read from the setting.

Thanks for HealthLog!

Activity

  1. MBombeck commented on Nov 27, 2026

    @MBombeck
    Owner

    Thanks @camiracode, that's a fair one. The hourly limit on CSV and JSON imports is there to keep a runaway script from filling the database, not to make a household wait.

    1.50.0 on Saturday 5 December adds IMPORT_RATE_LIMIT_PER_HOUR. The default stays at 5, and the "too many imports" message and the API docs read the value you set. I'm leaving out a per-user reset button: raising the limit covers the retry case without adding another admin screen.

    Refs #1638

  2. added
    enhancement
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions