From 54d661f03290688ef45b2aafc2452891f5b6e99e Mon Sep 17 00:00:00 2001 From: Lezek123 Date: Fri, 8 Nov 2024 11:39:44 +0100 Subject: [PATCH] 4.1.1.: Video relevance fixes --- CHANGELOG.md | 16 +++++++ package.json | 2 +- src/mappings/content/commentsAndReactions.ts | 8 +--- src/mappings/content/nft.ts | 2 +- src/mappings/content/utils.ts | 12 +---- src/mappings/content/video.ts | 3 +- src/mappings/token/index.ts | 3 +- src/mappings/utils.ts | 9 ---- src/processor.ts | 25 ++++++++++- .../resolvers/AdminResolver/index.ts | 8 ++-- .../resolvers/AdminResolver/utils.ts | 11 +++-- .../resolvers/ChannelsResolver/index.ts | 4 +- .../resolvers/VideosResolver/index.ts | 4 +- src/server-extension/utils.ts | 12 +++++ src/utils/VideoRelevanceManager.ts | 44 +++++++++++++------ src/utils/notification/helpers.ts | 16 ++++++- 16 files changed, 117 insertions(+), 62 deletions(-) create mode 100644 src/server-extension/utils.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f22ae2db5..b25f45491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# 4.1.1 + +## Affected components: +- Processor (non-breaking changes) +- GraphQL server (non-breaking changes) + +## Bug Fixes: +- Fixed video relevance calculation algorithm by: + - Ignoring `publishedBeforeJoystream` date if it's in the future, + - Fixing a bug with Joystream/YT creation weight formula, + - Introduced an age limit of 365 days to prevent negative relevance score +- Fixed ineffective `videoRelevanceManager` calls in GraphQL server due to `videoRelevanceManager` not being turned on. +- Fixed a bug causing both GraphQL server and Processor services to run video relevance and language update loops (which only processor should be running) +- Fixed imports in GraphQl server and Processor by moving shared utilities to root `utils` directory to prevent mix-ups. + + # 4.1.0 ## Affected components: diff --git a/package.json b/package.json index 7d453b353..df5f4af1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orion", - "version": "4.1.0", + "version": "4.1.1", "engines": { "node": ">=16" }, diff --git a/src/mappings/content/commentsAndReactions.ts b/src/mappings/content/commentsAndReactions.ts index 12fbe909a..44c9e16b7 100644 --- a/src/mappings/content/commentsAndReactions.ts +++ b/src/mappings/content/commentsAndReactions.ts @@ -53,13 +53,9 @@ import { commentCountersManager, videoRelevanceManager, } from '../utils' -import { - getAccountForMember, - getChannelOwnerMemberByChannelId, - memberHandleById, - parseVideoTitle, -} from './utils' +import { getAccountForMember, getChannelOwnerMemberByChannelId, memberHandleById } from './utils' import { addNotification } from '../../utils/notification' +import { parseVideoTitle } from '../../utils/notification/helpers' function parseVideoReaction(reaction: ReactVideo.Reaction): VideoReactionOptions { const protobufReactionToGraphqlReaction = { diff --git a/src/mappings/content/nft.ts b/src/mappings/content/nft.ts index dfeb5f579..80238bc0e 100644 --- a/src/mappings/content/nft.ts +++ b/src/mappings/content/nft.ts @@ -53,9 +53,9 @@ import { notifyBiddersOnAuctionCompletion, notifyChannelFollowers, parseContentActor, - parseVideoTitle, processNft, } from './utils' +import { parseVideoTitle } from '../../utils/notification/helpers' export async function processOpenAuctionStartedEvent({ overlay, diff --git a/src/mappings/content/utils.ts b/src/mappings/content/utils.ts index ea83f2eae..4ebc8e59c 100644 --- a/src/mappings/content/utils.ts +++ b/src/mappings/content/utils.ts @@ -75,6 +75,7 @@ import { criticalError } from '../../utils/misc' import { addNotification } from '../../utils/notification' import { EntityManagerOverlay, Flat } from '../../utils/overlay' import { addNftActivity, addNftHistoryEntry, genericEventFields, invalidMetadata } from '../utils' +import { parseChannelTitle, parseVideoTitle } from '../../utils/notification/helpers' // eslint-disable-next-line @typescript-eslint/no-explicit-any export type AsDecoded = MetaClass extends { create: (props?: infer I) => any } @@ -887,14 +888,6 @@ export function increaseChannelCumulativeRevenue(channel: Flat, amount: channel.cumulativeRevenue = (channel.cumulativeRevenue || 0n) + amount } -export function parseChannelTitle(channel: Flat): string { - return channel.title || FALLBACK_CHANNEL_TITLE -} - -export function parseVideoTitle(video: Flat