using DysonNetwork.Sphere.Account; using EFCore.BulkExtensions; using Quartz; namespace DysonNetwork.Sphere.Storage.Handlers; public class ActionLogFlushHandler(IServiceProvider serviceProvider) : IFlushHandler { public async Task FlushAsync(IReadOnlyList items) { using var scope = serviceProvider.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await db.BulkInsertAsync(items); } } public class ActionLogFlushJob(FlushBufferService fbs, ActionLogFlushHandler hdl) : IJob { public async Task Execute(IJobExecutionContext context) { await fbs.FlushAsync(hdl); } }