refactor(svcs): ♻🔥 rm some unnecessary thread context switching

This commit is contained in:
Collin M. Barrett 2021-11-11 15:57:07 -06:00
parent 1649ac6778
commit 1bfaf29952
4 changed files with 8 additions and 8 deletions

View file

@ -6,10 +6,10 @@ namespace FilterLists.Archival.Api;
public static class Program
{
// TODO: migrate to new hosting model https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-6.0&tabs=visual-studio#new-hosting-model
public static async Task Main(string[] args)
public static Task Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
await host.TryRunWithLoggingAsync();
return host.TryRunWithLoggingAsync();
}
public static IHostBuilder CreateHostBuilder(string[] args)

View file

@ -7,10 +7,10 @@ namespace FilterLists.Directory.Api;
public static class Program
{
// TODO: migrate to new hosting model https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-6.0&tabs=visual-studio#new-hosting-model
public static async Task Main(string[] args)
public static Task Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
await host.TryRunWithLoggingAsync(async () => await host.MigrateAsync());
return host.TryRunWithLoggingAsync(() => host.MigrateAsync());
}
public static IHostBuilder CreateHostBuilder(string[] args)

View file

@ -12,9 +12,9 @@ public QueryContext(QueryDbContext dbContext)
_dbContext = dbContext;
}
public async ValueTask DisposeAsync()
public ValueTask DisposeAsync()
{
await _dbContext.DisposeAsync();
return _dbContext.DisposeAsync();
}
public IQueryable<FilterList> FilterLists => _dbContext.FilterLists.AsNoTracking();

View file

@ -9,11 +9,11 @@ namespace FilterLists.Directory.Infrastructure.Persistence;
public static class SeedExtension
{
public static async Task MigrateAsync(this IHost host)
public static Task MigrateAsync(this IHost host)
{
using var scope = host.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<QueryDbContext>();
await db.Database.MigrateAsync();
return db.Database.MigrateAsync();
}
}