Fix: load cards to remove old cards from db
This commit is contained in:
		| @@ -46,7 +46,6 @@ func (cm *CronManager) CleanupRooms() { | ||||
| 			panic(r) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	rooms, err := cm.repo.RoomList(ctx) | ||||
| 	if err != nil { | ||||
| 		cm.log.Error("failed to get rooms list", "err", err) | ||||
| @@ -55,7 +54,6 @@ func (cm *CronManager) CleanupRooms() { | ||||
| 		} | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	for _, room := range rooms { | ||||
| 		players, err := cm.repo.PlayerListByRoom(ctx, room.ID) | ||||
| 		if err != nil { | ||||
| @@ -73,7 +71,6 @@ func (cm *CronManager) CleanupRooms() { | ||||
| 			} | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		creatorInRoom := false | ||||
| 		for _, player := range players { | ||||
| 			if player.Username == room.CreatorName { | ||||
| @@ -81,7 +78,6 @@ func (cm *CronManager) CleanupRooms() { | ||||
| 				break | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		if !creatorInRoom { | ||||
| 			cm.log.Info("deleting room because creator left", "room_id", room.ID) | ||||
| 			for _, player := range players { | ||||
| @@ -103,7 +99,6 @@ func (cm *CronManager) CleanupRooms() { | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if err := tx.Commit(); err != nil { | ||||
| 		cm.log.Error("failed to commit transaction", "err", err) | ||||
| 	} | ||||
| @@ -123,7 +118,6 @@ func (cm *CronManager) CleanupActions() { | ||||
| 			panic(r) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	if err := cm.repo.ActionDeleteOrphaned(ctx); err != nil { | ||||
| 		cm.log.Error("failed to delete orphaned actions", "err", err) | ||||
| 		if err := tx.Rollback(); err != nil { | ||||
| @@ -131,7 +125,6 @@ func (cm *CronManager) CleanupActions() { | ||||
| 		} | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	if err := tx.Commit(); err != nil { | ||||
| 		cm.log.Error("failed to commit transaction for actions cleanup", "err", err) | ||||
| 	} | ||||
| @@ -183,4 +176,3 @@ func (cm *CronManager) CleanupInactiveRooms() { | ||||
| 		cm.log.Error("failed to commit transaction for inactive rooms cleanup", "err", err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder