abort uploading large region map tiles as soon one fails

httptests
UbitUmarov 2018-01-18 04:28:05 +00:00
parent 0a81e35697
commit dd491bba57
2 changed files with 22 additions and 15 deletions

View File

@ -244,11 +244,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
(int)Constants.RegionSize, (int)Constants.RegionSize); (int)Constants.RegionSize, (int)Constants.RegionSize);
using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat))
{ {
ConvertAndUploadMaptile(scene, subMapTile, if(!ConvertAndUploadMaptile(scene, subMapTile,
scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize), scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize),
scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize), scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize),
scene.Name); scene.Name));
} {
m_log.DebugFormat("{0} Upload maptileS for {1} aborted!", LogHeader, scene.Name);
return; // abort rest;
}
}
} }
} }
} }
@ -280,7 +284,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
} }
} }
private void ConvertAndUploadMaptile(IScene scene, Image tileImage, uint locX, uint locY, string regionName) private bool ConvertAndUploadMaptile(IScene scene, Image tileImage, uint locX, uint locY, string regionName)
{ {
byte[] jpgData = Utils.EmptyBytes; byte[] jpgData = Utils.EmptyBytes;
@ -289,19 +293,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
tileImage.Save(stream, ImageFormat.Jpeg); tileImage.Save(stream, ImageFormat.Jpeg);
jpgData = stream.ToArray(); jpgData = stream.ToArray();
} }
if (jpgData != Utils.EmptyBytes)
{ if (jpgData == Utils.EmptyBytes)
string reason = string.Empty;
if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason))
{
m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader,
regionName, locX, locY, reason);
}
}
else
{ {
m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName); m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName);
return false;
} }
string reason = string.Empty;
if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason))
{
m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader,
regionName, locX, locY, reason);
return false;
}
return true;
} }
} }
} }

View File

@ -229,6 +229,7 @@ namespace OpenSim.Services.Connectors
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString, reqString,
30,
m_Auth); m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
@ -271,7 +272,7 @@ namespace OpenSim.Services.Connectors
{ {
// This just dumps a warning for any operation that takes more than 100 ms // This just dumps a warning for any operation that takes more than 100 ms
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile uploaded in {0}ms", tickdiff); m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile upload time {0}ms", tickdiff);
} }
return false; return false;