Skip to content

Commit 347d0bb

Browse files
committed
fix: lint
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 39f61f7 commit 347d0bb

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

services/apps/script_executor_worker/src/bin/recalculate-enrichment-affiliations.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
* CROWD_TEMPORAL_NAMESPACE - Temporal namespace
3838
* SERVICE - Service identifier (used by Temporal client)
3939
*/
40+
import { WorkflowIdReusePolicy } from '@temporalio/client'
41+
4042
import { DEFAULT_TENANT_ID } from '@crowd/common'
4143
import { WRITE_DB_CONFIG, getDbConnection } from '@crowd/data-access-layer/src/database'
4244
import { pgpQx } from '@crowd/data-access-layer/src/queryExecutor'
4345
import { getServiceChildLogger } from '@crowd/logging'
4446
import { TEMPORAL_CONFIG, getTemporalClient } from '@crowd/temporal'
45-
import { WorkflowIdReusePolicy } from '@temporalio/client'
4647

4748
const ENRICHMENT_SOURCES = ['enrichment-progai', 'enrichment-clearbit', 'enrichment-crustdata']
4849

@@ -181,21 +182,24 @@ async function main() {
181182
let totalFailed = 0
182183
let totalProcessed = 0
183184

184-
while (true) {
185+
let hasMore = true
186+
while (hasMore) {
185187
pageNum++
186188

187189
const remaining = opts.limit !== null ? opts.limit - totalProcessed : opts.pageSize
188190
if (remaining <= 0) {
189191
log.info(`Limit of ${opts.limit} members reached.`)
190-
break
192+
hasMore = false
193+
continue
191194
}
192195

193196
const fetchSize = Math.min(opts.pageSize, remaining)
194197
const membersPage = await fetchPage(qx, cursor, fetchSize)
195198

196199
if (membersPage.length === 0) {
197200
log.info('No more members to process.')
198-
break
201+
hasMore = false
202+
continue
199203
}
200204

201205
const lastMemberId = membersPage[membersPage.length - 1].memberId
@@ -238,7 +242,7 @@ async function main() {
238242

239243
if (membersPage.length < fetchSize) {
240244
// Last page (fewer results than requested means no more data)
241-
break
245+
hasMore = false
242246
}
243247

244248
if (opts.pageDelayMs > 0) {

0 commit comments

Comments
 (0)