mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 08:52:25 +00:00
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:
1 file changed
+18
-2
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user