updated concurrency

This commit is contained in:
Nihaal Sharma committed 2026-05-01 23:57:41 +01:00
1 parent aa9d2b72c3
commit 7a40a84e82
1 file changed
+18 -3
+18 -3
View File
@@ -197,10 +197,18 @@ class EmojiHoarder: BaseHoarder {
} }
nonisolated func batchDownload(emojis emojisToDownload: [any StickerProtocol]) async { nonisolated func batchDownload(emojis emojisToDownload: [any StickerProtocol]) async {
await withTaskGroup { group in
for emoji in emojisToDownload { for emoji in emojisToDownload {
await download(emoji: emoji, skipStoreIndex: true) group.addTask {
await self.download(emoji: emoji, skipStoreIndex: true)
await MainActor.run {
// Task { @MainActor in
self.downloadedStickers.insert(emoji.name)
self.downloadedStickersArr.append(emoji.name)
}
}
}
} }
await buildDownloadedStickers() await buildDownloadedStickers()
} }
@@ -219,9 +227,16 @@ class EmojiHoarder: BaseHoarder {
} }
nonisolated func batchDelete(emojis emojisToDelete: [any StickerProtocol]) async { nonisolated func batchDelete(emojis emojisToDelete: [any StickerProtocol]) async {
await withTaskGroup { group in
for emoji in emojisToDelete { for emoji in emojisToDelete {
await delete(emoji: emoji, skipStoreIndex: true) group.addTask {
await self.delete(emoji: emoji, skipStoreIndex: true)
} }
}
}
// for emoji in emojisToDelete {
// await delete(emoji: emoji, skipStoreIndex: true)
// }
await buildDownloadedStickers() await buildDownloadedStickers()
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.