scriptnull / badgeit

[WIP] Hassle-free badges for your READMEs.
MIT License
3 stars 1 forks source link

Redis rate limiting and cache implementation #24

Closed scriptnull closed 6 years ago

scriptnull commented 6 years ago

We need to rate limit the requests to the workers by tracking if a repo is already being processed.

Also, we need to cache the payload data for each git repositories.

scriptnull commented 6 years ago

Rate limiting and cache implementation are done.

API now returns back the following responses for GET /badges API

All reponses will contain the payload equivalent to

https://github.com/scriptnull/badgeit/blob/6e0665b0657c56f865a0da994d59c075dac8b3dc/api/main.go#L82-L87

Along with that, the a status object is also returned back with varying status codes.

  1. 200 - status: already processing - This is returned if the remote is being processed currently by one of the workers.
  2. 200 - status: already queued for processing - This is returned if the remote is currently residing in the queue
  3. 202 - status: successfully queued for processing - This is returned if the remote is successfully queued.