diff --git a/backend/src/database/repositories/integrationProgressRepository.ts b/backend/src/database/repositories/integrationProgressRepository.ts index d1207c1a66..8c8fdf2588 100644 --- a/backend/src/database/repositories/integrationProgressRepository.ts +++ b/backend/src/database/repositories/integrationProgressRepository.ts @@ -1,8 +1,5 @@ import { QueryTypes } from 'sequelize' -import { queryActivitiesCounter } from '@crowd/data-access-layer' -import { Counter, TinybirdClient } from '@crowd/data-access-layer/src/database' - import { Repos } from '@/serverless/integrations/types/regularTypes' import { GitHubStats } from '@/serverless/integrations/usecases/github/rest/getRemoteStats' @@ -86,56 +83,54 @@ class IntegrationProgressRepository { return (result[0] as any).id as string } - static async getDbStatsForGithub({ - repos, - segments, - }: { - repos: Repos - segments: string[] - }): Promise { - const tb = new TinybirdClient() - - const promises: Promise<{ data: Counter }>[] = [ - queryActivitiesCounter( - IntegrationProgressRepository.createPayloadWithActivityType(['star'], repos, segments), - tb, - ), - queryActivitiesCounter( - IntegrationProgressRepository.createPayloadWithActivityType(['unstar'], repos, segments), - tb, - ), - queryActivitiesCounter( - { - ...IntegrationProgressRepository.createPayloadWithActivityType(['fork'], repos, segments), - indirectFork: 1, - }, - tb, - ), - queryActivitiesCounter( - IntegrationProgressRepository.createPayloadWithActivityType( - ['issues-opened'], - repos, - segments, - ), - tb, - ), - queryActivitiesCounter( - IntegrationProgressRepository.createPayloadWithActivityType( - ['pull_request-opened'], - repos, - segments, - ), - tb, - ), - ] - - const result = await Promise.all(promises) + static async getDbStatsForGithub(): Promise { + // const tb = new TinybirdClient() + + // const promises: Promise<{ data: Counter }>[] = [ + // queryActivitiesCounter( + // IntegrationProgressRepository.createPayloadWithActivityType(['star'], repos, segments), + // tb, + // ), + // queryActivitiesCounter( + // IntegrationProgressRepository.createPayloadWithActivityType(['unstar'], repos, segments), + // tb, + // ), + // queryActivitiesCounter( + // { + // ...IntegrationProgressRepository.createPayloadWithActivityType(['fork'], repos, segments), + // indirectFork: 1, + // }, + // tb, + // ), + // queryActivitiesCounter( + // IntegrationProgressRepository.createPayloadWithActivityType( + // ['issues-opened'], + // repos, + // segments, + // ), + // tb, + // ), + // queryActivitiesCounter( + // IntegrationProgressRepository.createPayloadWithActivityType( + // ['pull_request-opened'], + // repos, + // segments, + // ), + // tb, + // ), + // ] + + // const result = await Promise.all(promises) return { - stars: (result[0]?.data?.[0]?.count ?? 0) - (result[1]?.data?.[0]?.count ?? 0), - forks: result[2]?.data?.[0]?.count ?? 0, - totalIssues: result[3]?.data?.[0]?.count ?? 0, - totalPRs: result[4]?.data?.[0]?.count ?? 0, + // stars: (result[0]?.data?.[0]?.count ?? 0) - (result[1]?.data?.[0]?.count ?? 0), + // forks: result[2]?.data?.[0]?.count ?? 0, + // totalIssues: result[3]?.data?.[0]?.count ?? 0, + // totalPRs: result[4]?.data?.[0]?.count ?? 0, + stars: 0, + forks: 0, + totalIssues: 0, + totalPRs: 0, } } diff --git a/backend/src/services/integrationService.ts b/backend/src/services/integrationService.ts index b919140b0a..ec52aace16 100644 --- a/backend/src/services/integrationService.ts +++ b/backend/src/services/integrationService.ts @@ -2195,16 +2195,12 @@ export default class IntegrationService { this.options.log.debug( `Evaluating cache for repos: ${repos.map((r) => r.name).join(',')} and segments: ${segments}`, ) - cachedStats = await IntegrationProgressRepository.getDbStatsForGithub({ - repos, - segments, - }) + cachedStats = await IntegrationProgressRepository.getDbStatsForGithub() this.options.log.debug(`Caching data: ${JSON.stringify(cachedStats)}`) // cache for 1 minute await cacheDb.set(key, JSON.stringify(cachedStats), 60) } else { - this.options.log.debug(`Cache data found: ${JSON.stringify(cachedStats)}`) cachedStats = JSON.parse(cachedStats) } return cachedStats as GitHubStats