mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(svcs): ♻🔥⚡ rm some unnecessary thread context switching
This commit is contained in:
parent
1649ac6778
commit
1bfaf29952
4 changed files with 8 additions and 8 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue