From eb6c70d0a7b62b59cd62a87c9d2c3ca9909b42a7 Mon Sep 17 00:00:00 2001
From: Gautam Anand <gautamgxtv@gmail.com>
Date: Wed, 30 Oct 2024 15:44:32 -0500
Subject: [PATCH] fgh

---
 components/storeGame.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/components/storeGame.js b/components/storeGame.js
index 6a1faab..7ae9344 100644
--- a/components/storeGame.js
+++ b/components/storeGame.js
@@ -6,6 +6,7 @@ const pendingUpdates = []; // Queue to store pending updates
 async function processPendingUpdates() {
   if (pendingUpdates.length === 0) return;
 
+  let cnt = 0;
   // Group updates by user secret
   const updatesByUser = {};
   pendingUpdates.forEach(({ secret, xp, timeTaken, latLong }) => {
@@ -35,15 +36,15 @@ async function processPendingUpdates() {
         });
         user.totalGamesPlayed += 1;
         user.totalXp += xp;
+        cnt++;
       });
-      console.log(`Processed ${userUpdates.length} updates for user ${secret}`);
 
       await user.save();
     } catch (error) {
       console.error(`Error saving user ${secret}:`, error.message);
     }
   }
-
+  console.log('Processed', cnt, 'updates');
   // Clear the pending updates queue after processing
   pendingUpdates.length = 0;
 }