Skip to content
This repository has been archived by the owner on Aug 19, 2018. It is now read-only.

Commit

Permalink
Merge pull request #393 from InWorldz/LSL-notecard-delays
Browse files Browse the repository at this point in the history
Lowered most notecard delays, new delays on some errors. (Mantis 3304)
  • Loading branch information
appurist committed Jul 25, 2017
2 parents 4092660 + 66a900e commit 65fe4d1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions InWorldz/InWorldz.Phlox.Engine/LSLSystemAPI.cs
Expand Up @@ -14500,6 +14500,9 @@ private void WithNotecard(UUID assetID, AssetRequestCallback cb)

public string GetNumberOfNotecardLines(SceneObjectPart part, string name)
{
const int ERROR_DELAY = 100;
const int LONG_DELAY = 50;
const int FAST_DELAY = 25;
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();

UUID assetID = UUID.Zero;
Expand All @@ -14520,7 +14523,7 @@ public string GetNumberOfNotecardLines(SceneObjectPart part, string name)
{
// => complain loudly, as specified by the LSL docs
ScriptShoutError("Notecard '" + name + "' could not be found.");

ScriptSleep(ERROR_DELAY);
return UUID.Zero.ToString();
}

Expand All @@ -14533,7 +14536,7 @@ public string GetNumberOfNotecardLines(SceneObjectPart part, string name)
{
AsyncCommands.
DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
ScriptSleep(100);
ScriptSleep(FAST_DELAY);
return tid.ToString();
}

Expand All @@ -14542,6 +14545,7 @@ public string GetNumberOfNotecardLines(SceneObjectPart part, string name)
if (a == null || a.Type != 7)
{
ScriptShoutError("Notecard '" + name + "' could not be found.");
ScriptSleep(ERROR_DELAY);
return;
}

Expand All @@ -14552,7 +14556,7 @@ public string GetNumberOfNotecardLines(SceneObjectPart part, string name)

NotecardCache.CacheCheck(); //this must be done in the script engine thread to avoid race conditions

ScriptSleep(100);
ScriptSleep(LONG_DELAY);
return tid.ToString();
}
public string llGetNumberOfNotecardLines(string name)
Expand All @@ -14577,7 +14581,9 @@ public string iwGetLinkNumberOfNotecardLines(int linknumber, string name)

private string GetNotecardSegment(SceneObjectPart part, string name, int line, int startOffset, int maxLength)
{
const int DELAY = 25;
const int LONG_DELAY = 25;
const int FAST_DELAY = 1;
const int LINES_PER_DELAY = 16; // every 16 lines, delay FAST_DELAY

TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();

Expand Down Expand Up @@ -14612,7 +14618,8 @@ private string GetNotecardSegment(SceneObjectPart part, string name, int line, i
{
AsyncCommands.
DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLine(assetID, line, startOffset, maxLength));
ScriptSleep(DELAY);
if (((line % LINES_PER_DELAY) == 0) && (startOffset == 0))
ScriptSleep(FAST_DELAY);
return tid.ToString();
}

Expand All @@ -14630,7 +14637,7 @@ private string GetNotecardSegment(SceneObjectPart part, string name, int line, i

NotecardCache.CacheCheck(); //this must be done in the script engine thread to avoid race conditions

ScriptSleep(DELAY);
ScriptSleep(LONG_DELAY);
return tid.ToString();
}

Expand Down

0 comments on commit 65fe4d1

Please sign in to comment.