aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2017-08-14 21:27:53 -0700
committerRobert Adams2017-08-14 21:27:53 -0700
commita754ab0e4f40e502aac55b8f117b2bfe4054ccfc (patch)
tree0164563fc89eeed22fdc92040c483f22689306c5
parentRevert "Let's try giving Common a default constructor instead of the workaround" (diff)
downloadopensim-SC-a754ab0e4f40e502aac55b8f117b2bfe4054ccfc.zip
opensim-SC-a754ab0e4f40e502aac55b8f117b2bfe4054ccfc.tar.gz
opensim-SC-a754ab0e4f40e502aac55b8f117b2bfe4054ccfc.tar.bz2
opensim-SC-a754ab0e4f40e502aac55b8f117b2bfe4054ccfc.tar.xz
Refactor archive loading to optionally start script engine after loading.
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs32
1 files changed, 20 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 6ba8cec..99ff9b5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -286,6 +286,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
286 /// </summary> 286 /// </summary>
287 public void DearchiveRegion() 287 public void DearchiveRegion()
288 { 288 {
289 DearchiveRegion(true);
290 }
291
292 public void DearchiveRegion(bool shouldStartScripts)
293 {
289 int successfulAssetRestores = 0; 294 int successfulAssetRestores = 0;
290 int failedAssetRestores = 0; 295 int failedAssetRestores = 0;
291 296
@@ -425,22 +430,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver
425 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so 430 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so
426 // that users can enter the scene. If we allow the scripts to start in the loop above 431 // that users can enter the scene. If we allow the scripts to start in the loop above
427 // then they significantly increase the time until the OAR finishes loading. 432 // then they significantly increase the time until the OAR finishes loading.
428 WorkManager.RunInThread(o => 433 if (shouldStartScripts)
429 { 434 {
430 Thread.Sleep(15000); 435 WorkManager.RunInThread(o =>
431 m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
432
433 foreach (DearchiveContext sceneContext in sceneContexts.Values)
434 { 436 {
435 foreach (SceneObjectGroup sceneObject in sceneContext.SceneObjects) 437 Thread.Sleep(15000);
438 m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
439
440 foreach (DearchiveContext sceneContext in sceneContexts.Values)
436 { 441 {
437 sceneObject.CreateScriptInstances(0, false, sceneContext.Scene.DefaultScriptEngine, 0); // StateSource.RegionStart 442 foreach (SceneObjectGroup sceneObject in sceneContext.SceneObjects)
438 sceneObject.ResumeScripts(); 443 {
439 } 444 sceneObject.CreateScriptInstances(0, false, sceneContext.Scene.DefaultScriptEngine, 0); // StateSource.RegionStart
445 sceneObject.ResumeScripts();
446 }
440 447
441 sceneContext.SceneObjects.Clear(); 448 sceneContext.SceneObjects.Clear();
442 } 449 }
443 }, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId)); 450 }, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId));
451 }
444 452
445 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 453 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
446 454