From 9b51db5f1ee179bf42615ab9cdccd95d2ae66547 Mon Sep 17 00:00:00 2001 From: Zeeshan Akram <97m.zeeshan@gmail.com> Date: Wed, 23 Oct 2024 13:48:21 +0000 Subject: [PATCH] fix opted out issue --- config.yml | 2 +- .../syncProcessing/YoutubePollingService.ts | 49 ++++++++++++------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/config.yml b/config.yml index f68a55b..d05d387 100644 --- a/config.yml +++ b/config.yml @@ -8,7 +8,7 @@ sync: enable: true downloadsDir: ./local/data intervals: # in minutes - youtubePolling: 1440 # 24 hours + youtubePolling: 2 # 24 hours contentProcessing: 1 limits: dailyApiQuota: diff --git a/src/services/syncProcessing/YoutubePollingService.ts b/src/services/syncProcessing/YoutubePollingService.ts index e9db1f8..c7d452f 100644 --- a/src/services/syncProcessing/YoutubePollingService.ts +++ b/src/services/syncProcessing/YoutubePollingService.ts @@ -86,20 +86,25 @@ export class YoutubePollingService { private async performChannelsIngestion(): Promise { // get all channels that need to be ingested const channelsWithSyncEnabled = async () => - await this.dynamodbService.repo.channels.scan({}, (scan) => - scan - .filter('yppStatus') - .in(['Unverified', ...verifiedVariants]) - .where('shouldBeIngested') - .eq(true) - .and() - .where('allowOperatorIngestion') - .eq(true) - .and() - // * Unauthorized channels add by infra operator are exempted from periodic - // * ingestion as we don't have access to their access/refresh tokens - .where('performUnauthorizedSync') - .eq(false) + await this.dynamodbService.repo.channels.scan( + {}, + (scan) => + scan + .filter('yppStatus') + .in(['Unverified', ...verifiedVariants]) + .where('shouldBeIngested') + .eq(true) + .and() + .where('allowOperatorIngestion') + .eq(true) + .and() + // * Unauthorized channels add by infra operator are exempted from periodic + // * ingestion as we don't have access to their access/refresh tokens + .where('performUnauthorizedSync') + .eq(false) + // .and() + // .where('id') + // .eq('UCBWgpKlykQ8yPAEmTGdsXxw') ) // updated channel objects with uptodate info @@ -191,12 +196,18 @@ export class YoutubePollingService { `Opting out '${channel.id}' from YPP program as their owner has revoked the permissions from Google settings` ) - await this.dynamodbService.repo.channels.save({ - ...channel, - yppStatus: 'OptedOut', - shouldBeIngested: false, - lastActedAt: new Date(), + this.logger.debug(`Google permissions error`, { + err, + channelId: channel.joystreamChannelId, + ytChannelId: channel.id, }) + + // await this.dynamodbService.repo.channels.save({ + // ...channel, + // yppStatus: 'OptedOut', + // shouldBeIngested: false, + // lastActedAt: new Date(), + // }) return }