copilot-swe-agent[bot] ArnavSingh76533 commited on
Commit
71e3c3d
·
1 Parent(s): dc76b3f

Remove debug logging and fix TypeScript error

Browse files

Co-authored-by: ArnavSingh76533 <160649079+ArnavSingh76533@users.noreply.github.com>

Files changed (1) hide show
  1. lib/cache.ts +1 -6
lib/cache.ts CHANGED
@@ -13,7 +13,6 @@ if (!globalForCache.roomsCache) {
13
  globalForCache.roomsCache = rooms
14
  }
15
 
16
- let userCount = globalForCache.userCount || 0
17
  if (!globalForCache.userCount) {
18
  globalForCache.userCount = 0
19
  }
@@ -21,7 +20,6 @@ if (!globalForCache.userCount) {
21
  const getUserCount = () => globalForCache.userCount || 0
22
  const setUserCount = (count: number) => {
23
  globalForCache.userCount = count
24
- userCount = count
25
  }
26
 
27
  export const getRoom = async (roomId: string): Promise<RoomState | null> => {
@@ -74,13 +72,10 @@ export const wipeCache = async (): Promise<"OK"> => {
74
 
75
  export const getPublicRooms = async (): Promise<RoomState[]> => {
76
  const publicRooms: RoomState[] = []
77
- console.log('[cache] getPublicRooms: total rooms =', rooms.size)
78
- for (const [roomId, room] of rooms) {
79
- console.log(`[cache] Room ${roomId}: isPublic =`, room.isPublic, 'users =', room.users.length)
80
  if (room.isPublic) {
81
  publicRooms.push(room)
82
  }
83
  }
84
- console.log('[cache] Returning', publicRooms.length, 'public rooms')
85
  return publicRooms
86
  }
 
13
  globalForCache.roomsCache = rooms
14
  }
15
 
 
16
  if (!globalForCache.userCount) {
17
  globalForCache.userCount = 0
18
  }
 
20
  const getUserCount = () => globalForCache.userCount || 0
21
  const setUserCount = (count: number) => {
22
  globalForCache.userCount = count
 
23
  }
24
 
25
  export const getRoom = async (roomId: string): Promise<RoomState | null> => {
 
72
 
73
  export const getPublicRooms = async (): Promise<RoomState[]> => {
74
  const publicRooms: RoomState[] = []
75
+ for (const [_, room] of rooms) {
 
 
76
  if (room.isPublic) {
77
  publicRooms.push(room)
78
  }
79
  }
 
80
  return publicRooms
81
  }