Too many refactors in one:

- Allowed adding ephemeral(ish) views and functions
- Moved message_count to a concrete database field
- Moved most proxy logic to a stored procedure
- Moved database files around and refactored schema manager
This commit is contained in:
Ske
2020-06-12 20:29:50 +02:00
parent 24f1363bb0
commit ba441a15cc
37 changed files with 554 additions and 398 deletions

View File

@@ -50,14 +50,16 @@ namespace PluralKit.Bot
private async Task<IReadOnlyList<PKListMember>> GetMemberList(PKSystem target, SortFilterOptions opts)
{
using var conn = await _db.Obtain();
await using var conn = await _db.Obtain();
var query = opts.BuildQuery();
var args = new {System = target.Id, opts.Filter};
_logger.Debug("Executing sort/filter query `{Query}` with arguments {Args}", query, args);
var timeBefore = _clock.GetCurrentInstant();
var results = (await conn.QueryAsync<PKListMember>(query, args)).ToList();
var timeAfter = _clock.GetCurrentInstant();
_logger.Debug("Executing sort/filter query `{Query}` with arguments {Args} returning {ResultCount} results in {QueryTime}", query, args, results.Count, timeAfter - timeBefore);
_logger.Debug("Executed sort/filter query `{Query}` returning {ResultCount} results in {QueryTime}", query, results.Count, timeAfter - timeBefore);
return results;
}