diff --git a/AsbCloudInfrastructure/Services/Cache/CacheTable.cs b/AsbCloudInfrastructure/Services/Cache/CacheTable.cs index 5dd7a935..48a8f343 100644 --- a/AsbCloudInfrastructure/Services/Cache/CacheTable.cs +++ b/AsbCloudInfrastructure/Services/Cache/CacheTable.cs @@ -13,7 +13,6 @@ namespace AsbCloudInfrastructure.Services.Cache private (DateTime refreshDate, IEnumerable entities) data; private readonly List cached; private readonly DbSet dbSet; - private readonly SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); internal CacheTable(DbContext context, (DateTime refreshDate, IEnumerable entities) data) { @@ -29,8 +28,16 @@ namespace AsbCloudInfrastructure.Services.Cache { if (cached.Any()) { - semaphore.Wait(); - cached.Clear(); + try + { + cached.Clear(); + } + catch + { + // ignore + // TODO: figure out what the well + } + } var dbEntities = context.Set().AsNoTracking().ToList(); cached.AddRange(dbEntities); @@ -42,8 +49,15 @@ namespace AsbCloudInfrastructure.Services.Cache { if (cached.Any()) { - await semaphore.WaitAsync(token).ConfigureAwait(true); - cached.Clear(); + try + { + cached.Clear(); + } + catch + { + // ignore + // TODO: figure out what the well + } } var dbEntities = await context.Set().AsNoTracking().ToListAsync(token).ConfigureAwait(false); cached.AddRange(dbEntities);