Skip to content

Commit

Permalink
fix opted out issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanakram3 committed Oct 23, 2024
1 parent 96b6539 commit 9b51db5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
49 changes: 30 additions & 19 deletions src/services/syncProcessing/YoutubePollingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,25 @@ export class YoutubePollingService {
private async performChannelsIngestion(): Promise<YtChannel[]> {
// 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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9b51db5

Please sign in to comment.