Skip to content

Commit 7e5a6fc

Browse files
committed
feat: better logs and exit
1 parent b1b8cd8 commit 7e5a6fc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/updateAllPriceConnections.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import prisma from 'prisma/clientInstance'
33
import { connectTransactionsListToPrices } from 'services/transactionService'
44
import { Transaction } from '@prisma/client'
55
import moment from 'moment'
6+
import { exit } from 'process'
67

78
async function misconnectTxs (txsIds: string[]): Promise<void> {
89
if (process.env.ENVIRONMENT === 'production') {
@@ -11,6 +12,7 @@ async function misconnectTxs (txsIds: string[]): Promise<void> {
1112
if (txsIds.length === 0) {
1213
return
1314
}
15+
console.log('Misconnecting', txsIds.length, 'for testing purposes')
1416
for (const txId of txsIds) {
1517
const tx = await prisma.transaction.findUniqueOrThrow({
1618
where: {
@@ -31,6 +33,7 @@ async function misconnectTxs (txsIds: string[]): Promise<void> {
3133
}
3234
})
3335
}
36+
console.log('Finished misconnecting txs')
3437
}
3538

3639
async function fixMisconnectedTxs (): Promise<void> {
@@ -82,13 +85,15 @@ async function fixMisconnectedTxs (): Promise<void> {
8285
})
8386
if (txsToFix.length !== 0) {
8487
console.log(`[${viewedCount}/${total}] Fixing ${txsToFix.length} txs...`)
88+
console.log('Tx ids:\n', txsToFix.map(t => t.id).join('\n'))
8589
await connectTransactionsListToPrices(txsToFix)
8690
console.log(`[${viewedCount}/${total}] Finished fixing ${txsToFix.length} txs.`)
8791
}
8892
console.log(`[${viewedCount}/${total}]`)
8993
page++
9094
}
9195
console.log('FINISHED')
96+
exit()
9297
}
9398

9499
async function run (): Promise<void> {

0 commit comments

Comments
 (0)