From 7a869760670029e4758133a73eb790af8be90ff3 Mon Sep 17 00:00:00 2001 From: Zontreck Date: Tue, 10 Mar 2020 16:19:34 -0700 Subject: [PATCH] change group cache handler --- Program.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Program.cs b/Program.cs index 178d3f9..a466ec5 100644 --- a/Program.cs +++ b/Program.cs @@ -807,12 +807,28 @@ namespace Bot bool Retry = true; while (Retry) { + int count = 0; client.Groups.RequestGroupRoles(DoCache.Value.ID); if (RoleReply.WaitOne(TimeSpan.FromSeconds(30), false)) { Retry = false; } 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"); + if(count >= 5) + { + MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Aborting group refresh attempt. Resetting cache and retrying"); + GroupsEvent.Reset(); + GroupsCache = new Dictionary(); + client.Groups.CurrentGroups -= Groups_CurrentGroups; + + Dictionary act = new Dictionary(); + act.Add("type", "reload_groups"); + MH.callbacks(MessageHandler.Destinations.DEST_ACTION, UUID.Zero, JsonConvert.SerializeObject(act)); + + return; + } + } } }