]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/videos/updater.ts
Update server dependencies
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / videos / updater.ts
index 0bf32f4401c4150b90125399ea06c898d12afc52..6ddd2301b0e917421e7c8a978089704905e8b391 100644 (file)
@@ -3,6 +3,7 @@ import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/h
 import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
 import { Notifier } from '@server/lib/notifier'
 import { PeerTubeSocket } from '@server/lib/peertube-socket'
+import { Hooks } from '@server/lib/plugins/hooks'
 import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'
 import { VideoLiveModel } from '@server/models/video/video-live'
 import { MActor, MChannelAccountLight, MChannelId, MVideoAccountLightBlacklistAllFiles, MVideoFullLight } from '@server/types/models'
@@ -81,11 +82,13 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
         PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated)
       }
 
+      Hooks.runAction('action:activity-pub.remote-video.updated', { video: videoUpdated, videoAPObject: this.videoObject })
+
       logger.info('Remote video with uuid %s updated', this.videoObject.uuid, this.lTags())
 
       return videoUpdated
     } catch (err) {
-      this.catchUpdateError(err)
+      await this.catchUpdateError(err)
     }
   }
 
@@ -151,9 +154,9 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
     videoUpdated.VideoLive = null
   }
 
-  private catchUpdateError (err: Error) {
+  private async catchUpdateError (err: Error) {
     if (this.video !== undefined) {
-      resetSequelizeInstance(this.video)
+      await resetSequelizeInstance(this.video)
     }
 
     // This is just a debug because we will retry the insert