Browse Source

Merge pull request #3027 from Lezek123/giza-migration-scripts-fix

Content migration script: Fix alternativeEndpoints
Mokhtar Naamani 3 năm trước cách đây
mục cha
commit
f6bd4c9871

+ 1 - 1
utils/migration-scripts/src/logging.ts

@@ -10,7 +10,7 @@ winston.addColors(colors)
 
 export function createLogger(label: string): Logger {
   return winston.createLogger({
-    level: 'debug',
+    level: process.env.DEBUG ? 'debug' : 'info',
     transports: [new winston.transports.Console()],
     defaultMeta: { label },
     format: winston.format.combine(

+ 2 - 0
utils/migration-scripts/src/sumer-giza/AssetsManager.ts

@@ -202,9 +202,11 @@ export class AssetsManager {
     let lastError: Error | undefined
     for (const endpoint of endpoints) {
       try {
+        this.logger.debug(`Trying to fetch asset ${contentId} from ${endpoint}...`)
         const tmpAssetPath = await this.fetchAsset(endpoint, contentId, expectedSize)
         return tmpAssetPath
       } catch (e) {
+        this.logger.debug(`Fetching ${contentId} from ${endpoint} failed: ${(e as Error).message}`)
         lastError = e as Error
         continue
       }

+ 1 - 0
utils/migration-scripts/src/sumer-giza/ContentMigration.ts

@@ -54,6 +54,7 @@ export class ContentMigration {
     const forcedChannelOwner = await this.getForcedChannelOwner()
     const assetsManager = await AssetsManager.create({
       api,
+      queryNodeApi,
       config,
     })
     const { idsMap: channelsMap, videoIds } = await new ChannelMigration({