# HG changeset patch # User unc0rr # Date 1317059133 -14400 # Node ID a740069c21e330ff9ee0a61b8b5404057156dcae # Parent 58d9badf3e7f771d003e8bb1eef169fd77880245 - Add unique id to replay file name - INSERT instead of UPDATE for stats diff -r 58d9badf3e7f -r a740069c21e3 gameServer/OfficialServer/GameReplayStore.hs --- a/gameServer/OfficialServer/GameReplayStore.hs Mon Sep 26 03:12:09 2011 +0200 +++ b/gameServer/OfficialServer/GameReplayStore.hs Mon Sep 26 21:45:33 2011 +0400 @@ -1,18 +1,23 @@ {-# LANGUAGE ScopedTypeVariables #-} module OfficialServer.GameReplayStore where -import CoreTypes import Data.Time import Control.Exception as E import qualified Data.Map as Map import Data.Sequence() import System.Log.Logger import Data.Maybe +import Data.Unique +import Control.Monad +--------------- +import CoreTypes + saveReplay :: RoomInfo -> IO () saveReplay r = do time <- getCurrentTime - let fileName = "replays/" ++ show time + u <- liftM hashUnique newUnique + let fileName = "replays/" ++ show time ++ "-" ++ show u let gi = fromJust $ gameInfo r let replayInfo = (teamsAtStart gi, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs gi) E.catch diff -r 58d9badf3e7f -r a740069c21e3 gameServer/OfficialServer/extdbinterface.hs --- a/gameServer/OfficialServer/extdbinterface.hs Mon Sep 26 03:12:09 2011 +0200 +++ b/gameServer/OfficialServer/extdbinterface.hs Mon Sep 26 21:45:33 2011 +0400 @@ -17,7 +17,7 @@ "SELECT users.pass, users_roles.rid FROM users LEFT JOIN users_roles ON users.uid = users_roles.uid WHERE users.name = ?" dbQueryStats = - "UPDATE gameserver_stats SET players = ?, rooms = ?, last_update = UNIX_TIMESTAMP()" + "INSERT INTO gameserver_stats (players, rooms, last_update) VALUES (?, ?, UNIX_TIMESTAMP())" dbInteractionLoop dbConn = forever $ do q <- liftM read getLine