Commit Graph

46 Commits

Author SHA1 Message Date
Ske
98613c4287 Add system and member privacy support 2020-01-11 16:51:13 +01:00
Ske
73b2631280 Optimize database queries for proxy filtering 2019-12-28 12:00:52 +01:00
Ske
4d07886ec8 Add server-specific display names 2019-12-26 20:39:47 +01:00
Ske
639c813ce7 Add per-server per-system proxy enable toggle 2019-12-22 14:15:56 +01:00
Ske
3b72fa720b Add warning when setting proxy tags conflicting with another member's 2019-12-21 21:42:06 +01:00
Ske
378cba09e5 Add channel blacklists for logging and proxying
Necessary database migrations for this commit:
    alter table servers add column log_blacklist bigint[] not null default array[]::bigint[];
    alter table servers add column blacklist bigint[] not null default array[]::bigint[];
2019-11-03 19:15:50 +01:00
Ske
7c3b4b9af9 Add command to delete all switches 2019-11-02 22:46:51 +01:00
Ske
49dc25ee02 Allow keeping proxy tags when proxying messages.
Required database migration:

Closes #75.
2019-10-30 09:26:50 +01:00
Ske
393ee16c1b Add support for multiple proxy tags
Tangentially closes #103.
2019-10-30 08:18:59 +01:00
Ske
46672d264c Refactor log channel storage 2019-10-27 23:01:20 +01:00
Ske
523469e5e6 Remove preemptive warning messages for unproxyable members
The member length limit is now long enough that it's unlikely to
hit the cap by accident. An error will still be displayed if you
attempt to perform a message proxy.
2019-10-27 21:57:31 +01:00
Ske
e6e1ab023a Fix type mismatch on system export 2019-10-27 14:49:46 +01:00
Noko
dd37c8a6d6 Fix bulk importer parameter and remove unused method (#136)
-Fixes AddSwitchesBulk post-refactor by passing in the switch timestamp instead of a set of PKMembers
-Removes unused RegisterSwitches method which was replaced by AddSwitchesBulk
2019-10-27 11:37:16 +01:00
Ske
6a73b3bdd6 Refactor data stores, merging the Store classes 2019-10-26 19:45:44 +02:00
Noko
406f005b4f Bulk import switches for pk;import
We're now using binary import for switches and switch_members when importing a system profile, rather than importing them one switch at a time.

This adds a pass-through method to the PerformanceTrackingConnection that can be used for other bulk import applications.
2019-10-20 14:38:43 -05:00
Noko
397da2e1fa Added max member count to limits
A given system can now have up to 1000 members. Within 50 members of that limit, a warning will display whenever a new member is created via the bot. Once the limit is reached, a final warning will appear indicating that no additional members can be created unless members are first deleted. Attempting to create a new member at that point by any method will result in an error message indicating that the limit has been reached.

Respecting this in pk;import required some restructuring to tease apart which members already exist and which ones need to be created prior to creating any members as it seems preferable to fail early and give the user the ability to intervene rather than pushing the system to the member cap and requiring manual deletion of "lower priority" members before others can be created. One consequence of the restructure is that existing members are being read in bulk which is a performance improvement of 25-70% depending on how many switches need to be imported (the more members you have, the more noticeable this is).
2019-10-20 02:16:57 -05:00
Noko
adea7be07c Improve export performance
Refactored ExportSystem to:
- Only fetch message counts once (instead of a query per member)
- Fetch switches using the newly refactored GetTruncatedSwitchList (gets switches and their members in one shot instead of querying for switch members one switch at a time)

- Added a new MessageCountsPerMember method to MemberStore to support the above
- Modified GetTruncatedSwitchList query to retrieve switches with no members (wasn't important for frontpercent, but is if we're reusing that method here)

This doesn't require any index changes beyond those that support GetTruncatedSwitchList, though we can see a small benefit with an index on messages covering the member column (valuable for other reasons outside of these additions).
2019-10-06 02:03:28 -05:00
Noko
ef7b825aa6
Merge pull request #1 from nephanim/feature/import-switches
Bring performance branch in line with export/import changes
2019-10-05 22:51:11 -05:00
Noko
845ec90c3e Improve frontpercent performance
Refactored GetTruncatedSwitchList to:
- Only fetch switches in the requested range
- Fetch switch members in bulk rather than one switch at a time

This uses a new GetSwitchMembersList method that requires the following indexes:

CREATE INDEX ix_switches_system
ON public.switches USING btree
(system ASC NULLS LAST)
INCLUDE("timestamp")
TABLESPACE pg_default;

CREATE INDEX ix_switch_members_switch
ON public.switch_members USING btree
(switch ASC NULLS LAST)
INCLUDE(member)
TABLESPACE pg_default;
2019-10-05 15:08:27 -05:00
Noko
7406f18bf5 Import switches
- ImportSystem builds a mapping of data file HID to current system HID
- Switches in a data file are reconciled with system members' actual IDs using this mapping
- SwitchStore provides a RegisterSwitches method to register multiple switches
- RegisterSwitches only imports a switch if one does not exist with the same timestamp
- The number of switches created is logged
2019-09-29 14:40:13 -05:00
Ske
74e0508065 Increase webhook name limit to 80 2019-08-14 07:16:48 +02:00
Ske
200ba6d84c Add member proxy display names 2019-08-09 10:12:38 +02:00
xBelladonna
29eefd7f5a Handle collision case when generating hid 2019-07-27 12:56:35 +02:00
Ske
b14666aa4f Store the ID of the trigger message in the database 2019-07-24 13:38:54 +02:00
Ske
11eabe2e3d Update D.NET version and add bulk deletion support 2019-07-21 17:16:04 +02:00
Ske
3103df856c Only log deleted messages if they were found previously 2019-07-21 03:44:26 +02:00
Ske
961bfe9094 Add basic logging framework 2019-07-18 17:13:42 +02:00
Ske
a188c64a0e Clean up unused imports 2019-07-17 13:38:23 +02:00
Ske
f53344cd89 Fix front percent returning negative percentages and ranges 2019-07-17 13:37:43 +02:00
Ske
02b41413b3 Add basic InfluxDB reporter 2019-07-16 23:34:22 +02:00
Ske
d5da3bf004 Clamp frontpercent range to actual switch range 2019-07-16 21:18:46 +02:00
Ske
b6ba24d171 Show front percent for switches with no fronter
Closes #113.
2019-07-15 21:51:41 +02:00
Ske
da307c2dc9 Display member count on system card 2019-07-15 17:36:10 +02:00
Ske
7e999f0a1d Ensure switch fronter order is stable 2019-07-14 21:48:10 +02:00
Ske
ebc311ecc3 Remove message query reaction AND open DB connection when obtaining one 2019-07-14 05:23:27 +02:00
Ske
a41e20a0a3 Fix importing with no existing system 2019-07-11 22:46:18 +02:00
Ske
d829630a35 Fix database connection pool contention (maybe)
Instead of acquiring a connection per service per request, we
acquire connections more often but at a more granular level, meaning
they're also disposed of more quickly instead of staying for a long time
in case of long-running commands or leaks.
2019-07-11 21:25:23 +02:00
Ske
42147fd9cc Add front percent command 2019-06-30 23:41:01 +02:00
Ske
2c3c46002a Add message lookup and log channel setting commands 2019-06-21 13:49:58 +02:00
Ske
652afffb8c Add importing and exporting function 2019-06-14 22:48:19 +02:00
Ske
d109ca7b57 Add switch deletion command 2019-06-13 17:05:50 +02:00
Ske
7e9b7dcc98 Add switch commands for adding and moving 2019-06-13 16:53:04 +02:00
Ske
4c6790432b Add system linking commands 2019-05-21 23:40:26 +02:00
Ske
b42e052fee bot: add member lookup command 2019-05-12 00:44:02 +02:00
Ske
9b49f22048 bot: enable .NET configuration management 2019-05-08 20:08:56 +02:00
Ske
c5d2b7c251 refactor project structure 2019-05-08 00:06:27 +02:00