mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-19 21:03:30 +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)
|
||||
|> Enum.each(fn %{thread: thread, messages: messages} ->
|
||||
try do
|
||||
author =
|
||||
messages
|
||||
|> Enum.min_by(& &1.timestamp, DateTime)
|
||||
|> Map.get(:author)
|
||||
author =
|
||||
messages
|
||||
|> Enum.min_by(& &1.timestamp, DateTime)
|
||||
|> Map.get(:author)
|
||||
|
||||
thread
|
||||
|> Map.put(:author, author)
|
||||
|> Map.from_struct()
|
||||
|> Map.put(:channel_id, thread.parent_id)
|
||||
|> Map.put(:tags, thread.applied_tags)
|
||||
|> Map.put(:create_timestamp, thread.thread_metadata.create_timestamp)
|
||||
|> Map.put(:messages, Enum.map(messages, &Map.from_struct/1))
|
||||
|> AshHq.Discord.Thread.upsert!()
|
||||
thread
|
||||
|> Map.put(:author, author)
|
||||
|> Map.from_struct()
|
||||
|> Map.put(:channel_id, thread.parent_id)
|
||||
|> Map.put(:tags, thread.applied_tags)
|
||||
|> Map.put(:create_timestamp, thread.thread_metadata.create_timestamp)
|
||||
|> Map.put(:messages, Enum.map(messages, &Map.from_struct/1))
|
||||
|> AshHq.Discord.Thread.upsert!()
|
||||
rescue
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue