Merge pull request #1162 from PR0M3TH3AN/codex/add-fallback-path-for-empty-actorkey

watchHistoryService: session actor fallback for publishView and local queue resilience
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-09 15:55:13 -05:00
commit cc345afbcd
1 file changed
+18 -2
+18 -2
View File
@@ -687,12 +687,22 @@ async function publishView(pointerInput, createdAt) {
return viewResult;
}
const actorCandidate =
let actorCandidate =
viewResult?.event?.pubkey ||
nostrClient?.pubkey ||
nostrClient?.sessionActor?.pubkey ||
"";
const actorKey = normalizeActorKey(actorCandidate);
let actorKey = normalizeActorKey(actorCandidate);
let usedSessionFallback = false;
if (!actorKey && typeof nostrClient?.ensureSessionActor === "function") {
await nostrClient.ensureSessionActor();
const sessionActorKey = normalizeActorKey(nostrClient?.sessionActor?.pubkey);
if (sessionActorKey) {
actorKey = sessionActorKey;
actorCandidate = nostrClient?.sessionActor?.pubkey || "";
usedSessionFallback = true;
}
}
if (!actorKey) {
userLogger.warn(
"[watchHistoryService] Unable to resolve actor for watch list update.",
@@ -700,6 +710,12 @@ async function publishView(pointerInput, createdAt) {
);
return viewResult;
}
if (usedSessionFallback) {
devLogger.info(
"[watchHistoryService] Using session actor fallback for watch history update.",
{ actor: actorKey }
);
}
const queue = ensureQueue(actorKey);
if (!queue) {