mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
Ensure watch history logging executes when service available
This commit is contained in:
1 parent
a4eb4f2367
commit
84b70475d9
2 files changed
+21
-4
No files matched your search
@@ -7585,10 +7585,9 @@ class bitvidApp {
|
||||
(async () => {
|
||||
let viewResult;
|
||||
try {
|
||||
const watchHistoryEnabled =
|
||||
watchHistoryService?.isEnabled?.() === true &&
|
||||
typeof watchHistoryService.publishView === "function";
|
||||
if (watchHistoryEnabled) {
|
||||
const canUseWatchHistoryService =
|
||||
typeof watchHistoryService?.publishView === "function";
|
||||
if (canUseWatchHistoryService) {
|
||||
viewResult = await watchHistoryService.publishView(thresholdPointer);
|
||||
} else if (typeof nostrClient?.recordVideoView === "function") {
|
||||
viewResult = await nostrClient.recordVideoView(thresholdPointer);
|
||||
|
||||
@@ -835,6 +835,13 @@ async function publishView(pointerInput, createdAt, metadata = {}) {
|
||||
);
|
||||
|
||||
if (!isFeatureEnabled()) {
|
||||
console.info(
|
||||
"[watchHistoryService] Watch history feature disabled; skipping queue update.",
|
||||
{
|
||||
pointer: pointerInput,
|
||||
createdAt,
|
||||
}
|
||||
);
|
||||
return viewResult;
|
||||
}
|
||||
|
||||
@@ -979,6 +986,13 @@ async function publishView(pointerInput, createdAt, metadata = {}) {
|
||||
|
||||
async function snapshot(items, options = {}) {
|
||||
if (!isFeatureEnabled()) {
|
||||
console.info(
|
||||
"[watchHistoryService] Snapshot skipped because watch history feature is disabled.",
|
||||
{
|
||||
requestedItems: Array.isArray(items) ? items.length : 0,
|
||||
reason: typeof options.reason === "string" ? options.reason : "manual",
|
||||
}
|
||||
);
|
||||
return { ok: true, skipped: true, reason: "feature-disabled" };
|
||||
}
|
||||
const reason = typeof options.reason === "string" ? options.reason : "manual";
|
||||
@@ -1091,6 +1105,10 @@ async function snapshot(items, options = {}) {
|
||||
|
||||
async function loadLatest(actorInput) {
|
||||
if (!isFeatureEnabled()) {
|
||||
console.info(
|
||||
"[watchHistoryService] loadLatest skipped because watch history feature is disabled.",
|
||||
{ actor: resolveActorKey(actorInput) || null }
|
||||
);
|
||||
return [];
|
||||
}
|
||||
const actorKey = resolveActorKey(actorInput);
|
||||
|
||||
Reference in new issue
Block a user