Skip to content

Commit

Permalink
Merge pull request #226 from BackendsByMTT/dev-g
Browse files Browse the repository at this point in the history
test 3
  • Loading branch information
TrippyRahul authored Sep 26, 2024
2 parents 6daa53c + cbe7d70 commit 06d0971
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/workers/processingQueueWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class ProcessingQueueWorker {
}

currentBetDetail.status = result;
currentBetDetail.isResolved = true;
await currentBetDetail.save();
console.log(`BetDetail with ID ${currentBetDetail._id} updated to '${result}'`);

Expand Down
10 changes: 5 additions & 5 deletions src/workers/waitingQueueWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function getLatestOddsForAllEvents() {


async function migrateAllBetsFromWaitingQueue() {
const bets = await redisClient.zrange('waitingQueue', 0, -1);
const bets = await redisClient.zrange('waitingQueue', 0, -1);

for (const bet of bets) {
const data = JSON.parse(bet);
Expand All @@ -126,19 +126,19 @@ async function migrateAllBetsFromWaitingQueue() {

if (!betDetail) {
console.log(`BetDetail not found for betId: ${betId}, skipping this bet.`);
continue;
continue;
}

if (!betDetail.key) {
console.log(`BetDetail with ID ${betId} is missing the 'key' field, skipping.`);
continue;
continue;
}

const betParent = await Bet.findById(betDetail.key).lean();

if (!betParent) {
console.log(`Parent Bet not found for betId: ${betId}, skipping.`);
continue;
continue;
}

await migrateLegacyBet(betDetail);
Expand All @@ -150,7 +150,7 @@ async function migrateAllBetsFromWaitingQueue() {
}

async function migrateLegacyResolvedBets() {
const bets = await BetDetail.find({ isResolved: true, status: { $ne: 'pending' } }).lean();
const bets = await BetDetail.find({ status: { $ne: 'pending' } }).lean();
for (const bet of bets) {
try {
await migrateLegacyBet(bet);
Expand Down

0 comments on commit 06d0971

Please sign in to comment.