This commit is contained in:
2021-05-22 13:44:34 +01:00
parent 047e8b235a
commit 778ee3aa03
32 changed files with 254 additions and 135 deletions
@@ -12,7 +12,7 @@ using System.Text;
namespace Saxonite.Net.Core.Web.Base.Consoles
{
//=======================================================================
public class SaxDataCacheConsole_Web : SaxDataCacheConsole
public abstract class SaxDataCacheConsole_Web : SaxDataCacheConsole
{
//-------------------------------------------------------------------
// Data members.
@@ -34,6 +34,10 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Utilities.
protected abstract void ForceRefresh();
//-------------------------------------------------------------------
// Regions.
public bool RegionsSupported { get; protected set; } = false;
@@ -48,7 +52,8 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
String fn = GetType().Name + ".ActiveRegions";
if (!RegionsSupported) throw new NotSupportedException(fn + " Regions not supported.");
List<SaxRegion> activeRegions = new List<SaxRegion>();
lock (regionsData)
if (regionsData.regions == null) ForceRefresh();
lock (regionsData)
{
if (regionsData.regions == null) throw new NotSupportedException(fn + " Regions not populated.");
activeRegions = new List<SaxRegion>(regionsData.activeRegions);
@@ -119,9 +124,9 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
String fn = GetType().Name + ".ActiveSports";
if (!SportsSupported) throw new NotSupportedException(fn + " Sports not supported.");
List<SaxSport> activeSports = new List<SaxSport>();
if (sportsData.sports == null) ForceRefresh();
lock (sportsData)
{
if (sportsData.sports == null) throw new NotSupportedException(fn + " Sports not populated.");
foreach (SaxSport sport in sportsData.sports.GetValues())
{
if (IsSportActive(sport))