change group cache handler
This commit is contained in:
parent
167b4da229
commit
7a86976067
1 changed files with 16 additions and 0 deletions
16
Program.cs
16
Program.cs
|
@ -807,12 +807,28 @@ namespace Bot
|
||||||
bool Retry = true;
|
bool Retry = true;
|
||||||
while (Retry)
|
while (Retry)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
client.Groups.RequestGroupRoles(DoCache.Value.ID);
|
client.Groups.RequestGroupRoles(DoCache.Value.ID);
|
||||||
if (RoleReply.WaitOne(TimeSpan.FromSeconds(30), false)) { Retry = false; }
|
if (RoleReply.WaitOne(TimeSpan.FromSeconds(30), false)) { Retry = false; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
count++;
|
||||||
MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "There appears to have been a failure requesting the group roles for secondlife:///app/group/" + DoCache.Value.ID.ToString() + "/about - Trying again");
|
MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "There appears to have been a failure requesting the group roles for secondlife:///app/group/" + DoCache.Value.ID.ToString() + "/about - Trying again");
|
||||||
|
|
||||||
|
if(count >= 5)
|
||||||
|
{
|
||||||
|
MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Aborting group refresh attempt. Resetting cache and retrying");
|
||||||
|
GroupsEvent.Reset();
|
||||||
|
GroupsCache = new Dictionary<UUID, Group>();
|
||||||
|
client.Groups.CurrentGroups -= Groups_CurrentGroups;
|
||||||
|
|
||||||
|
Dictionary<string, string> act = new Dictionary<string, string>();
|
||||||
|
act.Add("type", "reload_groups");
|
||||||
|
MH.callbacks(MessageHandler.Destinations.DEST_ACTION, UUID.Zero, JsonConvert.SerializeObject(act));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue