mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-20 05:13:23 +12:00
chore: ignore failed imports
This commit is contained in:
parent
4689afa66b
commit
3832da271a
1 changed files with 16 additions and 13 deletions
|
@ -106,22 +106,25 @@ defmodule AshHq.Discord.Poller do
|
||||||
end)
|
end)
|
||||||
|> Enum.each(fn %{thread: thread, messages: messages} ->
|
|> Enum.each(fn %{thread: thread, messages: messages} ->
|
||||||
try do
|
try do
|
||||||
author =
|
author =
|
||||||
messages
|
messages
|
||||||
|> Enum.min_by(& &1.timestamp, DateTime)
|
|> Enum.min_by(& &1.timestamp, DateTime)
|
||||||
|> Map.get(:author)
|
|> Map.get(:author)
|
||||||
|
|
||||||
thread
|
thread
|
||||||
|> Map.put(:author, author)
|
|> Map.put(:author, author)
|
||||||
|> Map.from_struct()
|
|> Map.from_struct()
|
||||||
|> Map.put(:channel_id, thread.parent_id)
|
|> Map.put(:channel_id, thread.parent_id)
|
||||||
|> Map.put(:tags, thread.applied_tags)
|
|> Map.put(:tags, thread.applied_tags)
|
||||||
|> Map.put(:create_timestamp, thread.thread_metadata.create_timestamp)
|
|> Map.put(:create_timestamp, thread.thread_metadata.create_timestamp)
|
||||||
|> Map.put(:messages, Enum.map(messages, &Map.from_struct/1))
|
|> Map.put(:messages, Enum.map(messages, &Map.from_struct/1))
|
||||||
|> AshHq.Discord.Thread.upsert!()
|
|> AshHq.Discord.Thread.upsert!()
|
||||||
rescue
|
rescue
|
||||||
e ->
|
e ->
|
||||||
Logger.error("Failed to import message:\n #{Exception.format(:error, e, __STACKTRACE__)}")
|
Logger.error(
|
||||||
|
"Failed to import message:\n #{Exception.format(:error, e, __STACKTRACE__)}"
|
||||||
|
)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue