Skip to content

Commit 80bfa4e

Browse files
committed
fix: Reduce import concurrency; run mix format
1 parent 99c011c commit 80bfa4e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎lib/octocon/workers/plural_kit_import_worker.ex‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ defmodule Octocon.Workers.PluralKitImportWorker do
88
- `pk_token` (binary): The PluralKit API token to use for the request.
99
"""
1010

11+
@insert_concurrency 10
12+
1113
alias Octocon.{
1214
Accounts,
1315
Alters,
@@ -56,8 +58,9 @@ defmodule Octocon.Workers.PluralKitImportWorker do
5658
alters
5759
|> Task.async_stream(
5860
&Repo.insert_regional(&1, {:user, {:system, system_id}}),
59-
max_concurrency: 20,
60-
ordered: false)
61+
max_concurrency: @insert_concurrency,
62+
ordered: false
63+
)
6164
|> Stream.run()
6265

6366
user = Accounts.get_user!({:system, system_id})

‎lib/octocon/workers/simply_plural_import_worker.ex‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ defmodule Octocon.Workers.SimplyPluralImportWorker do
88
- `sp_token` (binary): The Simply Plural API token to use for the request.
99
"""
1010

11+
@insert_concurrency 10
12+
1113
alias Octocon.{
1214
Accounts,
1315
Alters,
@@ -56,7 +58,7 @@ defmodule Octocon.Workers.SimplyPluralImportWorker do
5658
alters
5759
|> Task.async_stream(
5860
&Repo.insert_regional(&1, {:user, {:system, system_id}}),
59-
max_concurrency: 20,
61+
max_concurrency: @insert_concurrency,
6062
ordered: false
6163
)
6264
|> Stream.run()

0 commit comments

Comments
 (0)