feat: block running commands / proxying when system is being deleted

Large systems take way too long to delete, which causes any insert for that system to block a connection, which exhausts the connection pool
This commit is contained in:
spiral
2022-03-23 21:32:18 -04:00
parent 375e650c9e
commit be89f907a0
7 changed files with 31 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
create function message_context(account_id bigint, guild_id bigint, channel_id bigint)
returns table (
system_id int,
is_deleting bool,
log_channel bigint,
in_blacklist bool,
in_log_blacklist bool,
@@ -27,6 +28,7 @@ as $$
guild as (select * from servers where id = guild_id)
select
system.id as system_id,
system.is_deleting,
guild.log_channel,
(channel_id = any(guild.blacklist)) as in_blacklist,
(channel_id = any(guild.log_blacklist)) as in_log_blacklist,