Skip to content

[BUG] Incorrect rate_limit string due to static class attribute #131

@Ankitpardeshiii

Description

@Ankitpardeshiii

Bug Description

The rate_limit field in the Settings config is evaluated at class definition time instead of runtime. Because it depends on rate_limit_max_requests and rate_limit_window, changes from environment variables are not reflected, resulting in incorrect rate limit values.

To Reproduce

  1. Set in .env:
    RATE_LIMIT_MAX_REQUESTS=10
    RATE_LIMIT_WINDOW=120
  2. Start the backend.
  3. Log or print settings.rate_limit.

Expected Behavior

rate_limit should dynamically reflect the current values.
Example: 10 requests per 120s

Actual Behavior

The value remains 30 requests per 60s (default) even after env changes.

Screenshots/Logs

INFO: Loaded rate limit: 30 requests per 60s
Expected: 10 requests per 120s

Environment

OS: Windows 11
Shell: PowerShell 5.1
Node.js: 18.17.0
Python: 3.11.x
Coderrr: 1.1.0

Additional Context

This happens because rate_limit is a static class attribute instead of a computed property.

Checklist

  • I have searched for similar issues
  • I have included all requested information
  • I have verified .env
  • I have tested the latest version

Metadata

Metadata

Labels

ECWoC26Project For ECWoC 26bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions