I’m trying to call this thread but it isn’t working on render. Locally it works very well without any error…
def cleanup_inactive_rooms():
while True:
current_time = time.time()
inactive_rooms = [room_id for room_id, room in rooms.items() if current_time - room.get(‘last_activity’, 0) > ROOM_TIMEOUT]
for room_id in inactive_rooms:
room = rooms.pop(room_id, None)
if not any(thread.name == ‘queue_manager_thread’ for thread in threading.enumerate()):
threading.Thread(target=queue_manager, name=‘queue_manager_thread’, daemon=True).start()
if room:
for player_id in room.get(‘players’, {}):
player_images = room.get(player_id, )
for image_path in player_images:
try:
os.remove(image_path)
except FileNotFoundError:
pass
time.sleep(60) # verifica a cada 10 segundos
cleanup_thread = threading.Thread(target=cleanup_inactive_rooms, daemon=True)
cleanup_thread.start()