Skip to content

Commit

Permalink
Handle failures in retrieving channel threads
Browse files Browse the repository at this point in the history
  • Loading branch information
randomnetcat committed Jan 2, 2024
1 parent 3499bcd commit ea0aca4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/kotlin/org/randomcat/agorabot/util/DefaultArchiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,20 @@ private suspend fun archiveChannel(
launch(Dispatchers.Default) {
val threadChannels = buildList<ThreadChannel> {
addAll(channel.threadChannels)
addAll(channel.retrieveArchivedPublicThreadChannels().await())
addAll(channel.retrieveArchivedPrivateJoinedThreadChannels().await())

try {
// We may not be able to retrieve private thread channels we have not joined.
addAll(channel.retrieveArchivedPublicThreadChannels().await())
} catch (e: Exception) {
logger.warn("Failed to retrieve archived public thread channels: " + e.stackTraceToString())
}

try {
addAll(channel.retrieveArchivedPrivateJoinedThreadChannels().await())
} catch (e: Exception) {
logger.warn("Failed to retrieve archived joined private thread channels: " + e.stackTraceToString())
}

try {
addAll(channel.retrieveArchivedPrivateThreadChannels().await())
} catch (e: Exception) {
logger.warn("Failed to retrieve private thread channels: " + e.stackTraceToString())
Expand Down

0 comments on commit ea0aca4

Please sign in to comment.