feat: watchlist repository, remove ef core from all bot code

This commit is contained in:
sam 2024-10-28 02:14:41 +01:00
parent da4dfae27c
commit f0511a560c
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
19 changed files with 155 additions and 97 deletions

View file

@ -16,6 +16,8 @@
using System.Diagnostics;
using Catalogger.Backend.Cache.InMemoryCache;
using Catalogger.Backend.Database;
using Catalogger.Backend.Database.Dapper;
using Dapper;
using Humanizer;
using Microsoft.EntityFrameworkCore;
using Prometheus;
@ -39,8 +41,9 @@ public class MetricsCollectionService(
await using var scope = services.CreateAsyncScope();
await using var db = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
await using var conn = scope.ServiceProvider.GetRequiredService<DatabaseConnection>();
var messageCount = await db.Messages.CountAsync(ct);
var messageCount = await conn.ExecuteScalarAsync<int>("select count(id) from messages");
CataloggerMetrics.GuildsCached.Set(guildCache.Size);
CataloggerMetrics.ChannelsCached.Set(channelCache.Size);