feature/IO-3303-Socket-IO-Optimization-Auto-Add-Watchers-Gate - SocketIO Optimization / Auto Add Watchers Gate

This commit is contained in:
Dave Richer
2025-07-14 18:42:27 -04:00
parent fbd6766dcd
commit 72091e9eae
5 changed files with 182 additions and 98 deletions

View File

@@ -50,7 +50,12 @@ const autoAddWatchers = async (req) => {
try {
// Fetch bodyshop data from Redis
const bodyshopData = await getBodyshopFromRedis(shopId);
const notificationFollowers = bodyshopData?.notification_followers || [];
let notificationFollowers = bodyshopData?.notification_followers;
// Bail if notification_followers is missing or not an array
if (!notificationFollowers || !Array.isArray(notificationFollowers)) {
return;
}
// Execute queries in parallel
const [notificationData, existingWatchersData] = await Promise.all([