Skip to content

Commit c89889a

Browse files
committed
chore: fixed small issues
Signed-off-by: Uroš Marolt <uros@marolt.me>
1 parent 2ccc4f5 commit c89889a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

services/apps/data_sink_worker/src/bin/fix-member-attributes.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import MemberAttributeService from '../service/memberAttribute.service'
1414

1515
/* eslint-disable @typescript-eslint/no-explicit-any */
1616

17+
const BATCH_SIZE = process.env.TEST_RUN ? 1 : 5000
18+
1719
const log = getServiceLogger()
1820

1921
async function getMemberIds(
@@ -44,7 +46,7 @@ async function getMemberIds(
4446
and coalesce(kv.value, '') != '')
4547
${lastId ? `and id < '${lastId}'` : ''}
4648
order by id desc
47-
limit 5000)
49+
limit ${BATCH_SIZE})
4850
select m.id, m.attributes
4951
from members m
5052
inner join
@@ -254,6 +256,10 @@ setImmediate(async () => {
254256
const lastId = membersToFix[membersToFix.length - 1].id
255257
log.debug({ lastId }, 'Fetching next batch starting from last ID')
256258

259+
if (process.env.TEST_RUN) {
260+
break
261+
}
262+
257263
membersToFix = await getMemberIds(dbClient, lastId)
258264
log.info({ count: membersToFix.length }, 'Found members for next batch')
259265

0 commit comments

Comments
 (0)