From 4790f8576c868ac92b5f2c9e96e1f8629af09d4d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 14 Oct 2009 19:23:44 -0700 Subject: * Replaced (possibly broken?) math for calculating the unix timestamp in MySQLAssetData with Utils.DateTimeToUnixTime() * Disabled UpdateAccessTime() function since it was only writing zeros anyways. This gave me a significant performance improvement for startup times and avatar logins in standalone mode * Load attachments asynchronously so avatars with lots of attachments don't have to race the timeout clock to login --- OpenSim/Data/MySQL/MySQLAssetData.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 259e186..fc05d1d 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -44,7 +44,6 @@ namespace OpenSim.Data.MySQL private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private MySQLManager _dbConnection; - private long TicksToEpoch; #region IPlugin Members @@ -61,8 +60,6 @@ namespace OpenSim.Data.MySQL /// connect string override public void Initialise(string connect) { - TicksToEpoch = new DateTime(1970,1,1).Ticks; - // TODO: This will let you pass in the connect string in // the config, though someone will need to write that. if (connect == String.Empty) @@ -223,7 +220,7 @@ namespace OpenSim.Data.MySQL using (cmd) { // create unix epoch time - int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); cmd.Parameters.AddWithValue("?id", asset.ID); cmd.Parameters.AddWithValue("?name", assetName); cmd.Parameters.AddWithValue("?description", assetDescription); @@ -248,6 +245,9 @@ namespace OpenSim.Data.MySQL private void UpdateAccessTime(AssetBase asset) { + // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph + return; + lock (_dbConnection) { _dbConnection.CheckConnection(); @@ -262,7 +262,7 @@ namespace OpenSim.Data.MySQL using (cmd) { // create unix epoch time - int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); cmd.Parameters.AddWithValue("?id", asset.ID); cmd.Parameters.AddWithValue("?access_time", now); cmd.ExecuteNonQuery(); -- cgit v1.1