[backend/core] Fix the (now scoped) MetaService dependency in PushService

This commit is contained in:
Laura Hausmann 2024-03-24 16:33:03 +01:00
parent 72010f9ee2
commit 2065a73ad9
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 2 additions and 3 deletions

View file

@ -1,4 +1,3 @@
using EntityFramework.Exceptions.Common;
using Iceshrimp.Backend.Core.Database; using Iceshrimp.Backend.Core.Database;
using Iceshrimp.Backend.Core.Database.Tables; using Iceshrimp.Backend.Core.Database.Tables;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View file

@ -21,8 +21,7 @@ public class PushService(
ILogger<PushService> logger, ILogger<PushService> logger,
IServiceScopeFactory scopeFactory, IServiceScopeFactory scopeFactory,
HttpClient httpClient, HttpClient httpClient,
IOptions<Config.InstanceSection> config, IOptions<Config.InstanceSection> config
MetaService meta
) : BackgroundService ) : BackgroundService
{ {
protected override Task ExecuteAsync(CancellationToken stoppingToken) protected override Task ExecuteAsync(CancellationToken stoppingToken)
@ -86,6 +85,7 @@ public class PushService(
if (body.Length > 137) if (body.Length > 137)
body = body.Truncate(137).TrimEnd() + "..."; body = body.Truncate(137).TrimEnd() + "...";
var meta = scope.ServiceProvider.GetRequiredService<MetaService>();
var (priv, pub) = await meta.GetMany(MetaEntity.VapidPrivateKey, MetaEntity.VapidPublicKey); var (priv, pub) = await meta.GetMany(MetaEntity.VapidPrivateKey, MetaEntity.VapidPublicKey);
var client = new WebPushClient(httpClient); var client = new WebPushClient(httpClient);