ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix concurrency cache issue
Chocobozzzff6652bbbab0
diff --git a/server/core/lib/activitypub/video-comments.ts b/server/core/lib/activitypub/video-comments.tsindex 1080dff7ae..d14a9784b4 100644--- a/server/core/lib/activitypub/video-comments.ts+++ b/server/core/lib/activitypub/video-comments.ts@@ -163,8 +163,8 @@ async function tryToResolveThreadFromVideo (params: ResolveThreadParams) {// Return the automatic tags by account id (owner and server accounts) and assign the held for review status to the comment if neededasync function getAutomaticTagsAndAssignReview (comment: MComment, video: MVideoAccountLight) {- // Remote comment already exists in database or remote video -> we don't need to rebuild automatic tags- if (comment.id) return []+ // Remote comment already exists in database -> we don't need to rebuild automatic tags+ if (comment.id) return {}const ownerAccount = video.VideoChannel.Accountdiff --git a/server/core/lib/automatic-tags/automatic-tagger.ts b/server/core/lib/automatic-tags/automatic-tagger.tsindex aaee5a15ed..21fc2f66ca 100644--- a/server/core/lib/automatic-tags/automatic-tagger.ts+++ b/server/core/lib/automatic-tags/automatic-tagger.ts@@ -88,7 +88,7 @@ export class AutomaticTagger {// Watched words by account that published the videoconst watchedWords = await WatchedWordsListModel.buildWatchedWordsRegexp({ accountId: account.id, transaction })- logger.debug(`Got watched words regex for account ${account.getDisplayName()}`, {+ logger.debug(`Got watched words regex for account ${account.id}`, {listNames: watchedWords.map(r => r.listName),...lTags()})diff --git a/server/core/lib/automatic-tags/automatic-tags.ts b/server/core/lib/automatic-tags/automatic-tags.tsindex 97e67fecdd..d054163c7a 100644--- a/server/core/lib/automatic-tags/automatic-tags.ts+++ b/server/core/lib/automatic-tags/automatic-tags.ts@@ -21,6 +21,7 @@ export async function setAndSaveCommentAutomaticTags (options: {transaction?: Transaction}) {const { comment, automaticTagsByAccount, transaction } = options+ if (Object.keys(automaticTagsByAccount).length === 0) returnconst { toCreateItems, toDeleteItems } = await _buildAutomaticTagItems({automaticTagsByAccount,@@ -59,6 +60,8 @@ export async function setAndSaveVideoAutomaticTags (options: {}) {const { video, automaticTagsByAccount, transaction } = options+ if (Object.keys(automaticTagsByAccount).length === 0) return+const { toCreateItems, toDeleteItems } = await _buildAutomaticTagItems({automaticTagsByAccount,diff --git a/server/core/models/watched-words/watched-words-list.ts b/server/core/models/watched-words/watched-words-list.tsindex 0e15d433e0..006ec93ff2 100644--- a/server/core/models/watched-words/watched-words-list.ts+++ b/server/core/models/watched-words/watched-words-list.ts@@ -204,7 +204,7 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>return result}- static createList (options: {+ static async createList (options: {accountId: numberlistName: string@@ -213,9 +213,11 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>transaction?: Transaction}) {+ const list = await super.create<MWatchedWordsList>(options, { transaction: options.transaction })+WatchedWordsListModel.regexCache.delete(options.accountId)- return super.create<MWatchedWordsList>(options, { transaction: options.transaction })+ return list}static removeImportedBySubscription (options: {@@ -236,7 +238,7 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>})}- updateList (options: {+ async updateList (options: {listName: stringwords?: string[]transaction?: Transaction@@ -250,17 +252,17 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>if (words) this.words = wordsif (listName) this.listName = listName- WatchedWordsListModel.regexCache.delete(this.accountId)+ await this.save({ transaction })- return this.save({ transaction })+ WatchedWordsListModel.regexCache.delete(this.accountId)}- destroy (options: {+ async destroy (options: {transaction?: Transaction} = {}) {- WatchedWordsListModel.regexCache.delete(this.accountId)+ await super.destroy(options)- return super.destroy(options)+ WatchedWordsListModel.regexCache.delete(this.accountId)}toFormattedJSON (): WatchedWordsList {