private void RetryLastSeen() { foreach (KeyValuePair <long, CachingList <LastSeen.Builder_LastSeen> > storageLastSeen in m_failedLastSeen) { RelayNode node; if (Registrar.TryGetValue(storageLastSeen.Key, out node)) { RelayStorage store = node.Storage; foreach (LastSeen.Builder_LastSeen builder in storageLastSeen.Value) { if (MyAPIGateway.Entities.EntityExists(builder.EntityId)) { LastSeen ls = new LastSeen(builder); if (ls.IsValid) { Logger.DebugLog("Successfully created a LastSeen. Primary node: " + storageLastSeen.Key + ", entity: " + ls.Entity.nameWithId()); storageLastSeen.Value.Remove(builder); } else { Logger.AlwaysLog("Unknown failure with last seen", Rynchodon.Logger.severity.ERROR); } } else { Logger.DebugLog("Not yet available: " + builder.EntityId); } } storageLastSeen.Value.ApplyRemovals(); if (storageLastSeen.Value.Count == 0) { Logger.DebugLog("Finished with: " + storageLastSeen.Key, Rynchodon.Logger.severity.DEBUG); m_failedLastSeen.Remove(storageLastSeen.Key); } else { Logger.DebugLog("For " + storageLastSeen.Key + ", " + storageLastSeen.Value.Count + " builders remain"); } } else { Logger.DebugLog("Failed to get node for " + storageLastSeen.Key, Rynchodon.Logger.severity.WARNING); } } m_failedLastSeen.ApplyRemovals(); if (m_failedLastSeen.Count() == 0) { Logger.DebugLog("All LastSeen have been successfully added", Rynchodon.Logger.severity.INFO); m_failedLastSeen = null; UpdateManager.Unregister(100, RetryLastSeen); } else { Logger.DebugLog(m_failedLastSeen.Count() + " primary nodes still have last seen to be added"); if (Globals.UpdateCount >= 3600) { foreach (KeyValuePair <long, CachingList <LastSeen.Builder_LastSeen> > storageLastSeen in m_failedLastSeen) { foreach (LastSeen.Builder_LastSeen builder in storageLastSeen.Value) { Logger.AlwaysLog("Failed to add last seen to world. Primary node: " + storageLastSeen.Key + ", entity ID: " + builder.EntityId, Rynchodon.Logger.severity.WARNING); } } m_failedLastSeen = null; UpdateManager.Unregister(100, RetryLastSeen); } } }