Sped up and reduce storage usage of read receipt

This commit is contained in:
2025-05-18 12:14:23 +08:00
parent fdfdffa382
commit 205ccd66b3
8 changed files with 95 additions and 39 deletions

View File

@ -1,5 +1,6 @@
using DysonNetwork.Sphere.Account;
using EFCore.BulkExtensions;
using Quartz;
namespace DysonNetwork.Sphere.Storage.Handlers;
@ -9,7 +10,15 @@ public class ActionLogFlushHandler(IServiceProvider serviceProvider) : IFlushHan
{
using var scope = serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<AppDatabase>();
await db.BulkInsertAsync(items);
}
}
public class ActionLogFlushJob(FlushBufferService fbs, ActionLogFlushHandler hdl) : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await fbs.FlushAsync(hdl);
}
}