git » sdk » commit 4b7d540

Log/skip when store fails rather than getting stuck

author Stephen Paul Weber
2026-11-10 03:08:06 UTC
committer Stephen Paul Weber
2026-11-10 03:08:06 UTC
parent 567d6b56593b9da512a9238041b9ddadef684b9c

Log/skip when store fails rather than getting stuck

borogove/Chat.hx +10 -0

diff --git a/borogove/Chat.hx b/borogove/Chat.hx
index 0eea49b..7d95a44 100644
--- a/borogove/Chat.hx
+++ b/borogove/Chat.hx
@@ -1324,6 +1324,11 @@ class DirectChat extends Chat {
 						client.notifyMessageHandlers(stored, stored.versions.length > 1 ? CorrectionEvent : DeliveryEvent);
 						client.trigger("chats/update", [this]);
 					});
+				}, (e) -> {
+					trace("Failed to store outgoing message", { chatId: chatId, localId: message.localId, error: e });
+					// Don't let this item block every later message
+					outboxItem.handle(() -> {});
+					return null;
 				});
 			case ReactionUpdateStanza(update):
 				persistence.storeReaction(client.accountId(), update).then((stored) -> {
@@ -2560,6 +2565,11 @@ class Channel extends Chat {
 						client.notifyMessageHandlers(stored, stored.versions.length > 1 ? CorrectionEvent : DeliveryEvent);
 						client.trigger("chats/update", [this]);
 					});
+				}, (e) -> {
+					trace("Failed to store outgoing message", { chatId: chatId, localId: message.localId, error: e });
+					// Don't let this item block every later message
+					outboxItem.handle(() -> {});
+					return null;
 				});
 			case ReactionUpdateStanza(update):
 				persistence.storeReaction(client.accountId(), update).then((stored) -> {