Skip to content

Commit 71f4535

Browse files
committed
fixes related to ratelimit
1 parent e571ca5 commit 71f4535

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

core/config/config.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ config :canary, Oban,
5858
engine: Oban.Engines.Basic,
5959
queues: [
6060
default: 10,
61-
github_processor: 2,
61+
github_processor: 1,
6262
webpage_processor: 2,
6363
email: 10,
64-
trieve: 50,
64+
trieve: 5,
6565
tinybird: 1
6666
],
6767
repo: Canary.Repo,

core/lib/canary/index/trieve/client.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ defmodule Canary.Index.Trieve.Actual do
6262
}
6363
) do
6464
{:ok, %{status: 200, body: _}} -> :ok
65-
{:ok, %{status: status, body: error}} when status in 400..499 -> {:error, error}
65+
{:ok, %{status: status, body: error}} when status in 400..599 -> {:error, error}
6666
{:error, error} -> {:error, error}
6767
end
6868
end
@@ -75,7 +75,7 @@ defmodule Canary.Index.Trieve.Actual do
7575
headers: [{"TR-Dataset", tracking_id}]
7676
) do
7777
{:ok, %{status: 204}} -> :ok
78-
{:ok, %{status: status, body: error}} when status in 400..499 -> {:error, error}
78+
{:ok, %{status: status, body: error}} when status in 400..599 -> {:error, error}
7979
{:error, error} -> {:error, error}
8080
end
8181
end
@@ -94,7 +94,7 @@ defmodule Canary.Index.Trieve.Actual do
9494
# https://docs.trieve.ai/api-reference/chunk-group/create-or-upsert-group-or-groups
9595
case client |> Req.post(url: "/chunk_group", json: data) do
9696
{:ok, %{status: 200, body: _}} -> :ok
97-
{:ok, %{status: status, body: error}} when status in 400..499 -> {:error, error}
97+
{:ok, %{status: status, body: error}} when status in 400..599 -> {:error, error}
9898
{:error, error} -> {:error, error}
9999
end
100100
end
@@ -107,7 +107,7 @@ defmodule Canary.Index.Trieve.Actual do
107107
params: [delete_chunks: true]
108108
) do
109109
{:ok, %{status: 204}} -> :ok
110-
{:ok, %{status: status, body: error}} when status in 400..499 -> {:error, error}
110+
{:ok, %{status: status, body: error}} when status in 400..599 -> {:error, error}
111111
{:error, error} -> {:error, error}
112112
end
113113
end
@@ -185,7 +185,7 @@ defmodule Canary.Index.Trieve.Actual do
185185
{:ok, %{status: 200}} ->
186186
{:cont, :ok}
187187

188-
{:ok, %{status: status, body: error}} when status in 400..499 ->
188+
{:ok, %{status: status, body: error}} when status in 400..599 ->
189189
{:halt, {:error, error}}
190190

191191
{:error, error} ->
@@ -200,7 +200,7 @@ defmodule Canary.Index.Trieve.Actual do
200200
{:ok, %{status: 200}} ->
201201
:ok
202202

203-
{:ok, %{status: status, body: error}} when status in 400..499 ->
203+
{:ok, %{status: status, body: error}} when status in 400..599 ->
204204
{:error, error}
205205

206206
{:error, error} ->
@@ -336,7 +336,7 @@ defmodule Canary.Index.Trieve.Actual do
336336
{:ok, %{status: 200, body: %{"results" => results}}} ->
337337
{:ok, results}
338338

339-
{:ok, %{status: status, body: error}} when status in 400..499 ->
339+
{:ok, %{status: status, body: error}} when status in 400..599 ->
340340
if error["message"] =~ "Should have at least one value for match" do
341341
{:ok, []}
342342
else
@@ -365,7 +365,7 @@ defmodule Canary.Index.Trieve.Actual do
365365
# https://docs.trieve.ai/api-reference/chunk-group/get-chunks-in-group-by-tracking-id
366366
case client |> Req.get(url: "/chunk_group/tracking_id/#{group_tracking_id}/#{page}") do
367367
{:ok, %{status: 200, body: result}} -> {:ok, result}
368-
{:ok, %{status: status, body: error}} when status in 400..499 -> {:error, error}
368+
{:ok, %{status: status, body: error}} when status in 400..599 -> {:error, error}
369369
{:error, error} -> {:error, error}
370370
end
371371
end)

0 commit comments

Comments
 (0)