Skip to content

Commit 80b69a0

Browse files
committed
chore: lint fixes in packages_worker
Signed-off-by: anilb <epipav@gmail.com>
1 parent 896c1bf commit 80b69a0

6 files changed

Lines changed: 26 additions & 13 deletions

File tree

services/apps/packages_worker/src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export function getPackagesDbConfig() {
2020

2121
export function getEnricherConfig() {
2222
const rawTokens = process.env.ENRICHER_GITHUB_TOKENS ?? ''
23-
const tokens = rawTokens.split(',').map((t) => t.trim()).filter(Boolean)
23+
const tokens = rawTokens
24+
.split(',')
25+
.map((t) => t.trim())
26+
.filter(Boolean)
2427

2528
return {
2629
tokens,

services/apps/packages_worker/src/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getDbConnection } from '@crowd/database'
21
import { pgpQx } from '@crowd/data-access-layer/src/queryExecutor'
2+
import { getDbConnection } from '@crowd/database'
33

44
import { getPackagesDbConfig } from './config'
55

services/apps/packages_worker/src/enricher/fetchLightRepo.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export async function fetchLightRepo(url: string, token: string): Promise<LightR
6767

6868
if (json.errors?.length) {
6969
const err = json.errors[0]
70-
if (err.type === 'RATE_LIMITED') throw new FetchError('RATE_LIMIT', `RATE_LIMITED for ${url}`, resetMs)
70+
if (err.type === 'RATE_LIMITED')
71+
throw new FetchError('RATE_LIMIT', `RATE_LIMITED for ${url}`, resetMs)
7172
if (err.type === 'NOT_FOUND') throw new FetchError('NOT_FOUND', `NOT_FOUND for ${url}`)
7273
throw new FetchError('TRANSIENT', `GraphQL error for ${url}: ${err.message ?? err.type}`)
7374
}
@@ -82,7 +83,9 @@ export async function fetchLightRepo(url: string, token: string): Promise<LightR
8283
name,
8384
description: repo.description ?? null,
8485
primaryLanguage: repo.primaryLanguage?.name ?? null,
85-
topics: (repo.repositoryTopics?.nodes ?? []).map((n: { topic: { name: string } }) => n.topic.name),
86+
topics: (repo.repositoryTopics?.nodes ?? []).map(
87+
(n: { topic: { name: string } }) => n.topic.name,
88+
),
8689
stars: repo.stargazerCount ?? 0,
8790
forks: repo.forkCount ?? 0,
8891
watchers: repo.watchers?.totalCount ?? 0,

services/apps/packages_worker/src/enricher/runEnrichmentLoop.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { getServiceChildLogger } from '@crowd/logging'
21
import { QueryExecutor } from '@crowd/data-access-layer/src/queryExecutor'
2+
import { getServiceChildLogger } from '@crowd/logging'
33

44
import { getEnricherConfig } from '../config'
5+
56
import { fetchLightRepo, parseGithubUrl } from './fetchLightRepo'
67
import { FetchError, LightRepoResult } from './types'
78
import { updateEnrichedRepos } from './updateEnrichedRepos'
@@ -10,10 +11,7 @@ const log = getServiceChildLogger('github-repos-enricher')
1011

1112
const MAX_RETRIES = 3
1213

13-
async function fetchWithRetries(
14-
url: string,
15-
token: string,
16-
): Promise<LightRepoResult | null> {
14+
async function fetchWithRetries(url: string, token: string): Promise<LightRepoResult | null> {
1715
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
1816
try {
1917
return await fetchLightRepo(url, token)
@@ -171,7 +169,13 @@ export async function runEnrichmentLoop(
171169
continue
172170
}
173171

174-
const { fetched, failed, flushed } = await processPage(urls, config.tokens, parkedUntil, config, qx)
172+
const { fetched, failed, flushed } = await processPage(
173+
urls,
174+
config.tokens,
175+
parkedUntil,
176+
config,
177+
qx,
178+
)
175179

176180
log.info(
177181
`Page ${pageNum}: read=${urls.length} fetched=${fetched} failed=${failed} flushed=${flushed}`,

services/apps/packages_worker/src/enricher/updateEnrichedRepos.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import { getServiceChildLogger } from '@crowd/logging'
21
import { QueryExecutor } from '@crowd/data-access-layer/src/queryExecutor'
2+
import { getServiceChildLogger } from '@crowd/logging'
33

44
import { LightRepoResult } from './types'
55

66
const log = getServiceChildLogger('github-repos-enricher:update')
77

8-
export async function updateEnrichedRepos(qx: QueryExecutor, rows: LightRepoResult[]): Promise<void> {
8+
export async function updateEnrichedRepos(
9+
qx: QueryExecutor,
10+
rows: LightRepoResult[],
11+
): Promise<void> {
912
if (rows.length === 0) return
1013

1114
for (const r of rows) {

services/apps/packages_worker/src/npm/activities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { getServiceChildLogger } from '@crowd/logging'
33
const log = getServiceChildLogger('npm')
44

55
export async function sayHiNpm(): Promise<string> {
6-
log.info('👋 hi from npm activity')
6+
log.info('hi from npm activity')
77
return 'hi from npm'
88
}

0 commit comments

Comments
 (0)