Skip to content

Commit 89a55a8

Browse files
committed
feat(app): Give feedback over socket when import fails
1 parent 1a2d363 commit 89a55a8

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

‎lib/octocon/workers/plural_kit_import_worker.ex‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ defmodule Octocon.Workers.PluralKitImportWorker do
8585
}
8686
)
8787

88-
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "alters_created", %{
89-
alters:
90-
Enum.map(alters, fn {alter, _query} -> OctoconWeb.System.AlterJSON.data_me(alter) end)
91-
})
92-
9388
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "pk_import_complete", %{
9489
alter_count: alter_count
9590
})
@@ -141,6 +136,9 @@ defmodule Octocon.Workers.PluralKitImportWorker do
141136
e ->
142137
Logger.error("Error importing PluralKit alters")
143138
Logger.error(Exception.format(:error, e, __STACKTRACE__))
139+
140+
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "pk_import_failed", %{})
141+
144142
{:error, e}
145143
end
146144

‎lib/octocon/workers/simply_plural_import_worker.ex‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ defmodule Octocon.Workers.SimplyPluralImportWorker do
8989
Enum.map(custom_fields, fn {_field_id, field} -> field end)
9090
)
9191

92-
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "alters_created", %{
93-
alters:
94-
Enum.map(alters, fn {alter, _query} -> OctoconWeb.System.AlterJSON.data_me(alter) end)
95-
})
96-
9792
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "sp_import_complete", %{
9893
alter_count: alter_count
9994
})
@@ -146,6 +141,9 @@ defmodule Octocon.Workers.SimplyPluralImportWorker do
146141
e ->
147142
Logger.error("Error importing Simply Plural alters")
148143
Logger.error(Exception.format(:error, e, __STACKTRACE__))
144+
145+
OctoconWeb.Endpoint.broadcast!("system:#{system_id}", "sp_import_failed", %{})
146+
149147
{:error, e}
150148
end
151149

0 commit comments

Comments
 (0)