mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 06:47:56 +00:00
Move count stat collecting to raw SQL
This commit is contained in:
parent
767a37e637
commit
2038f023a0
3 changed files with 19 additions and 46 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -113,12 +113,6 @@ namespace PluralKit.Core {
|
|||
await conn.ExecuteAsync("delete from switches where system = @Id", system);
|
||||
}
|
||||
|
||||
public async Task<ulong> GetTotalSystems()
|
||||
{
|
||||
using (var conn = await _conn.Obtain())
|
||||
return await conn.ExecuteScalarAsync<ulong>("select count(id) from systems");
|
||||
}
|
||||
|
||||
public async Task<PKMember> CreateMember(PKSystem system, string name) {
|
||||
PKMember member;
|
||||
using (var conn = await _conn.Obtain())
|
||||
|
|
@ -226,12 +220,6 @@ namespace PluralKit.Core {
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<ulong> GetTotalMessages()
|
||||
{
|
||||
using (var conn = await _conn.Obtain())
|
||||
return await conn.ExecuteScalarAsync<ulong>("select count(mid) from messages");
|
||||
}
|
||||
|
||||
public async Task AddSwitch(PKSystem system, IEnumerable<PKMember> members)
|
||||
{
|
||||
// Use a transaction here since we're doing multiple executed commands in one
|
||||
|
|
@ -336,12 +324,6 @@ namespace PluralKit.Core {
|
|||
_logger.Information("Deleted switch {Switch}");
|
||||
}
|
||||
|
||||
public async Task<ulong> GetTotalSwitches()
|
||||
{
|
||||
using (var conn = await _conn.Obtain())
|
||||
return await conn.ExecuteScalarAsync<ulong>("select count(id) from switches");
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SwitchListEntry>> GetPeriodFronters(PKSystem system, Instant periodStart, Instant periodEnd)
|
||||
{
|
||||
// TODO: IAsyncEnumerable-ify this one
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue