reuse dbcontext where applicable

This commit is contained in:
rootdarkarchon 2023-10-17 23:18:59 +02:00
parent 0f718dbf43
commit 527b95a271
4 changed files with 8 additions and 9 deletions

View file

@ -25,7 +25,7 @@ public class UserPairCacheService : IHostedService
_cache.TryRemove(uid, out _);
}
public async Task<Dictionary<string, UserInfo>> GetAllPairs(string uid)
public async Task<Dictionary<string, UserInfo>> GetAllPairs(string uid, MareDbContext dbContext)
{
await WaitForProcessing(uid).ConfigureAwait(false);
@ -33,7 +33,6 @@ public class UserPairCacheService : IHostedService
{
_logger.LogDebug("Building full cache: Did not find PairData for {uid}", uid);
using var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false);
_cache[uid] = await BuildFullCache(dbContext, uid).ConfigureAwait(false);
}