Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: spike on adding rate limits to freeway #109

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Commits on Jun 13, 2024

  1. wip: spike on adding rate limits to freeway

    Add a new middleware that checks a rate limiting service and returns a 429 if the CID is over a rate limit.
    
    This sketches out an API for the rate limiting and accounting services suggested in storacha/RFC#28
    
    This is not ready to merge, but should probably be the starting point for this work once we all agree that this is the right shape.
    travis committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    b421208 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2024

  1. feat: flesh out token flow

    introduce a KV namespace for caching token metadata - for now the "invalid" boolean is the most important thing, as that's how we decide whether a token is valid.
    
    I thought we'd be able to serve tokened requests when in doubt, but I'm a bit worried about people generating random tokens if we go that route - sending a different random token with each request would theoretically allow them to make infinite unbilled requests.
    
    instead I went with a pattern that will likely require us to warm the cache before a token-based request achieves hot-storage level performance - we cache auth token metadata in KV and wait for the accounting service to return it if we don't find it in the cache. Using a "Stale While Revalidate" pattern to update the cache will allow us to maintain performance and the ability to disable tokens.
    travis committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    a4a8bb4 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2024

  1. more comments

    travis committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    10d8fe8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    83132c7 View commit details
    Browse the repository at this point in the history
  3. fix: clean up merge

    travis committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    7e61026 View commit details
    Browse the repository at this point in the history