aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorDiva Canto2013-07-14 15:47:54 -0700
committerDiva Canto2013-07-14 15:47:54 -0700
commitb0140383da21de03cb655160a2912d04c5b470e6 (patch)
tree091f9a16f9f8da857820938e093c20ac7aafad97 /OpenSim/Data
parentHG UAS: Moved hg-session data from memory to DB storage. This makes it so tha... (diff)
downloadopensim-SC_OLD-b0140383da21de03cb655160a2912d04c5b470e6.zip
opensim-SC_OLD-b0140383da21de03cb655160a2912d04c5b470e6.tar.gz
opensim-SC_OLD-b0140383da21de03cb655160a2912d04c5b470e6.tar.bz2
opensim-SC_OLD-b0140383da21de03cb655160a2912d04c5b470e6.tar.xz
Cleanup old hg sessions (older than 2 days)
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/IHGTravelingData.cs1
-rw-r--r--OpenSim/Data/MySQL/MySQLHGTravelData.cs10
-rw-r--r--OpenSim/Data/MySQL/Resources/HGTravelStore.migrations1
3 files changed, 12 insertions, 0 deletions
diff --git a/OpenSim/Data/IHGTravelingData.cs b/OpenSim/Data/IHGTravelingData.cs
index dd89935..452af7b 100644
--- a/OpenSim/Data/IHGTravelingData.cs
+++ b/OpenSim/Data/IHGTravelingData.cs
@@ -54,5 +54,6 @@ namespace OpenSim.Data
54 HGTravelingData[] GetSessions(UUID userID); 54 HGTravelingData[] GetSessions(UUID userID);
55 bool Store(HGTravelingData data); 55 bool Store(HGTravelingData data);
56 bool Delete(UUID sessionID); 56 bool Delete(UUID sessionID);
57 void DeleteOld();
57 } 58 }
58} \ No newline at end of file 59} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/MySQLHGTravelData.cs b/OpenSim/Data/MySQL/MySQLHGTravelData.cs
index 1efbfc3..e81b880 100644
--- a/OpenSim/Data/MySQL/MySQLHGTravelData.cs
+++ b/OpenSim/Data/MySQL/MySQLHGTravelData.cs
@@ -66,5 +66,15 @@ namespace OpenSim.Data.MySQL
66 return Delete("SessionID", sessionID.ToString()); 66 return Delete("SessionID", sessionID.ToString());
67 } 67 }
68 68
69 public void DeleteOld()
70 {
71 using (MySqlCommand cmd = new MySqlCommand())
72 {
73 cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 DAY", m_Realm);
74
75 ExecuteNonQuery(cmd);
76 }
77
78 }
69 } 79 }
70} \ No newline at end of file 80} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations
index a0c9ebe..b4e4422 100644
--- a/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations
@@ -9,6 +9,7 @@ CREATE TABLE `hg_traveling_data` (
9 `ServiceToken` VARCHAR(255) NOT NULL DEFAULT '', 9 `ServiceToken` VARCHAR(255) NOT NULL DEFAULT '',
10 `ClientIPAddress` VARCHAR(16) NOT NULL DEFAULT '', 10 `ClientIPAddress` VARCHAR(16) NOT NULL DEFAULT '',
11 `MyIPAddress` VARCHAR(16) NOT NULL DEFAULT '', 11 `MyIPAddress` VARCHAR(16) NOT NULL DEFAULT '',
12 `TMStamp` timestamp NOT NULL,
12 PRIMARY KEY (`SessionID`), 13 PRIMARY KEY (`SessionID`),
13 KEY (`UserID`) 14 KEY (`UserID`)
14) ENGINE=InnoDB; 15) ENGINE=InnoDB;