Refactor archive loading to optionally start script engine after loading.
parent
eb837defdf
commit
a754ab0e4f
|
@ -285,6 +285,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// Dearchive the region embodied in this request.
|
/// Dearchive the region embodied in this request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DearchiveRegion()
|
public void DearchiveRegion()
|
||||||
|
{
|
||||||
|
DearchiveRegion(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DearchiveRegion(bool shouldStartScripts)
|
||||||
{
|
{
|
||||||
int successfulAssetRestores = 0;
|
int successfulAssetRestores = 0;
|
||||||
int failedAssetRestores = 0;
|
int failedAssetRestores = 0;
|
||||||
|
@ -425,22 +430,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so
|
// Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so
|
||||||
// that users can enter the scene. If we allow the scripts to start in the loop above
|
// that users can enter the scene. If we allow the scripts to start in the loop above
|
||||||
// then they significantly increase the time until the OAR finishes loading.
|
// then they significantly increase the time until the OAR finishes loading.
|
||||||
WorkManager.RunInThread(o =>
|
if (shouldStartScripts)
|
||||||
{
|
{
|
||||||
Thread.Sleep(15000);
|
WorkManager.RunInThread(o =>
|
||||||
m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
|
|
||||||
|
|
||||||
foreach (DearchiveContext sceneContext in sceneContexts.Values)
|
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup sceneObject in sceneContext.SceneObjects)
|
Thread.Sleep(15000);
|
||||||
{
|
m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
|
||||||
sceneObject.CreateScriptInstances(0, false, sceneContext.Scene.DefaultScriptEngine, 0); // StateSource.RegionStart
|
|
||||||
sceneObject.ResumeScripts();
|
|
||||||
}
|
|
||||||
|
|
||||||
sceneContext.SceneObjects.Clear();
|
foreach (DearchiveContext sceneContext in sceneContexts.Values)
|
||||||
}
|
{
|
||||||
}, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId));
|
foreach (SceneObjectGroup sceneObject in sceneContext.SceneObjects)
|
||||||
|
{
|
||||||
|
sceneObject.CreateScriptInstances(0, false, sceneContext.Scene.DefaultScriptEngine, 0); // StateSource.RegionStart
|
||||||
|
sceneObject.ResumeScripts();
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneContext.SceneObjects.Clear();
|
||||||
|
}
|
||||||
|
}, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId));
|
||||||
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
|
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue