Skip to content

Commit

Permalink
Release 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Sep 19, 2024
1 parent 3d87490 commit 49caf9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Enhancements
- Add basic rate limiting retries to the FlyBackend to abide by Fly's rate limits of 1 request per second, with 3 requests per second burst.
- Add basic retries for `no capacity` errors in the FlyBackend

## 0.5.0 (2024-09-11)

Expand Down
6 changes: 5 additions & 1 deletion lib/flame/fly_backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ defmodule FLAME.FlyBackend do
{:ok, {{_, 200, _}, _, response_body}} ->
JSON.decode!(response_body)

{:ok, {{_, 429, _}, _, _response_body}} when remaining_tries > 0 ->
# 429 Too Many Requests (rate limited)
# 412 Precondition Failed (can't find capacity)
# 409 Conflict (the flyd tried ending up not having capacity)
# 422 Unprocessable Entity (could not find capcity for volume workloads)
{:ok, {{_, status, _}, _, _response_body}} when status in [429, 412, 409, 422] and remaining_tries > 0 ->
Process.sleep(1000)
http_post!(url, remaining_tries - 1, opts)

Expand Down

0 comments on commit 49caf9f

Please sign in to comment.