]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/videos/get.ts
Fix reset sequelize instance
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / videos / get.ts
index d7500c71a5e5f5c317a4631f467c6130aef94e52..14ba550346d5722fd13fe7589b0768df0726971c 100644 (file)
@@ -1,4 +1,5 @@
 import { retryTransactionWrapper } from '@server/helpers/database-utils'
+import { logger } from '@server/helpers/logger'
 import { JobQueue } from '@server/lib/job-queue'
 import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders'
 import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models'
@@ -77,6 +78,8 @@ async function getOrCreateAPVideo (
     if (err.name === 'SequelizeUniqueConstraintError') {
       const alreadyCreatedVideo = await loadVideoByUrl(videoUrl, fetchType)
       if (alreadyCreatedVideo) return { video: alreadyCreatedVideo, created: false }
+
+      logger.error('Cannot create video %s because of SequelizeUniqueConstraintError error, but cannot find it in database.', videoUrl)
     }
 
     throw err
@@ -104,7 +107,7 @@ async function scheduleRefresh (video: MVideoThumbnail, fetchType: VideoLoadByUr
     return refreshVideoIfNeeded(refreshOptions)
   }
 
-  await JobQueue.Instance.createJobWithPromise({
+  await JobQueue.Instance.createJob({
     type: 'activitypub-refresher',
     payload: { type: 'video', url: video.url }
   })