Fix CA1851
This commit is contained in:
committed by
Pavel Penev
parent
2996a1ddde
commit
c2568ebd1f
@@ -1294,10 +1294,13 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var unknownMaps = server.MapPool.Where(server.MapIsUnknown);
|
var unknownMaps = server.MapPool.Where(server.MapIsUnknown).ToList();
|
||||||
if (server.Settings.QueryMapRepository && unknownMaps.Any())
|
if (unknownMaps.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (server.Settings.QueryMapRepository)
|
||||||
{
|
{
|
||||||
Log.Write("server", $"Querying Resource Center for information on {unknownMaps.Count()} maps...");
|
Log.Write("server", $"Querying Resource Center for information on {unknownMaps.Count} maps...");
|
||||||
|
|
||||||
// Query any missing maps and wait up to 10 seconds for a response
|
// Query any missing maps and wait up to 10 seconds for a response
|
||||||
// Maps that have not resolved will not be valid for the initial map choice
|
// Maps that have not resolved will not be valid for the initial map choice
|
||||||
@@ -1306,12 +1309,17 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
|
|
||||||
var searchingMaps = server.MapPool.Where(uid => mapCache[uid].Status == MapStatus.Searching);
|
var searchingMaps = server.MapPool.Where(uid => mapCache[uid].Status == MapStatus.Searching);
|
||||||
var stopwatch = Stopwatch.StartNew();
|
var stopwatch = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
// Each time we check, some map statuses may have updated.
|
||||||
|
#pragma warning disable CA1851 // Possible multiple enumerations of 'IEnumerable' collection
|
||||||
while (searchingMaps.Any() && stopwatch.ElapsedMilliseconds < 10000)
|
while (searchingMaps.Any() && stopwatch.ElapsedMilliseconds < 10000)
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
|
#pragma warning restore CA1851
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unknownMaps.Any())
|
var stillUnknownMaps = server.MapPool.Where(server.MapIsUnknown).ToList();
|
||||||
Log.Write("server", "Failed to resolve maps: " + unknownMaps.JoinWith(", "));
|
if (stillUnknownMaps.Count != 0)
|
||||||
|
Log.Write("server", "Failed to resolve maps: " + stillUnknownMaps.JoinWith(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ChooseInitialMap(S server)
|
static string ChooseInitialMap(S server)
|
||||||
|
|||||||
Reference in New Issue
Block a user