* 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 loginprioritization
parent
fe4109a5b0
commit
4790f8576c
|
@ -44,7 +44,6 @@ namespace OpenSim.Data.MySQL
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private MySQLManager _dbConnection;
|
private MySQLManager _dbConnection;
|
||||||
private long TicksToEpoch;
|
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
||||||
|
@ -61,8 +60,6 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <param name="connect">connect string</param>
|
/// <param name="connect">connect string</param>
|
||||||
override public void Initialise(string connect)
|
override public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
TicksToEpoch = new DateTime(1970,1,1).Ticks;
|
|
||||||
|
|
||||||
// TODO: This will let you pass in the connect string in
|
// TODO: This will let you pass in the connect string in
|
||||||
// the config, though someone will need to write that.
|
// the config, though someone will need to write that.
|
||||||
if (connect == String.Empty)
|
if (connect == String.Empty)
|
||||||
|
@ -223,7 +220,7 @@ namespace OpenSim.Data.MySQL
|
||||||
using (cmd)
|
using (cmd)
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
// 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("?id", asset.ID);
|
||||||
cmd.Parameters.AddWithValue("?name", assetName);
|
cmd.Parameters.AddWithValue("?name", assetName);
|
||||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||||
|
@ -248,6 +245,9 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
private void UpdateAccessTime(AssetBase asset)
|
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)
|
lock (_dbConnection)
|
||||||
{
|
{
|
||||||
_dbConnection.CheckConnection();
|
_dbConnection.CheckConnection();
|
||||||
|
@ -262,7 +262,7 @@ namespace OpenSim.Data.MySQL
|
||||||
using (cmd)
|
using (cmd)
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
// 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("?id", asset.ID);
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
|
@ -2402,11 +2402,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||||
item = InventoryService.GetItem(item);
|
item = InventoryService.GetItem(item);
|
||||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
||||||
IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
|
|
||||||
if (ava != null)
|
if (m_AvatarFactory != null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt);
|
m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt);
|
||||||
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2481,7 +2481,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (aCircuit == null || aCircuit.child == false)
|
if (aCircuit == null || aCircuit.child == false)
|
||||||
{
|
{
|
||||||
sp.IsChildAgent = false;
|
sp.IsChildAgent = false;
|
||||||
sp.RezAttachments();
|
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3841,6 +3841,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
List<int> attPoints = m_appearance.GetAttachedPoints();
|
List<int> attPoints = m_appearance.GetAttachedPoints();
|
||||||
foreach (int p in attPoints)
|
foreach (int p in attPoints)
|
||||||
{
|
{
|
||||||
|
if (m_isDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
UUID itemID = m_appearance.GetAttachedItem(p);
|
UUID itemID = m_appearance.GetAttachedItem(p);
|
||||||
UUID assetID = m_appearance.GetAttachedAsset(p);
|
UUID assetID = m_appearance.GetAttachedAsset(p);
|
||||||
|
|
||||||
|
@ -3866,9 +3869,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString());
|
m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue