Commit graph

75 commits

Author SHA1 Message Date
Noi
e6e335b5dc Implement new suggestions from framework upgrade 2024-04-28 18:15:12 -07:00
Noi
2977ae61f1 Whitespace and style fixes 2024-04-28 01:51:58 -07:00
Noi
85bb07ed96 Fix tickCount incrementing more than once per tick 2023-12-08 20:45:40 -08:00
Noi
41def830c4 Only remove data from guilds in own shard 2023-12-08 20:44:42 -08:00
Noi
b9b057e1f1 Remove extraneous log messages
In particular, these changes filter out the reporting of any errors
occurring during the bot shutdown process.
2023-09-04 17:41:10 -07:00
Noi
1aaca8545e Extremely minor refactoring 2023-09-04 17:41:10 -07:00
Noi
b87602f8f6 Greatly reduce frequency of stale entry removal 2023-09-04 17:40:56 -07:00
Noi
21cbadb355 Retry skipped guilds after reconnection 2023-09-04 17:40:48 -07:00
Noi
cee7bb4835 Manually call GC on occasion (experimental) 2023-09-04 17:40:35 -07:00
Noi
b0b39bbd0b Allow configuration of certain time-based values 2023-05-27 18:07:45 -07:00
Noi
c893b317f0 Fix logged message's grammar; bump version 2023-03-05 23:05:37 -08:00
Noi
29f2eeb31e Skip user download in guilds where the method hangs
A workaround for an apparent bug in Discord.Net's
`SocketGuild.DownloadUsersAsync()` method.

Conclusions made while writing and testing this workaround:
* The guilds it hangs on are seemingly random.
* Guild size does not matter.
* If a download hangs, it never recovers within 2 hours, probably more.
* Trying a guild again never works. It just hangs again.
2023-03-05 22:57:09 -08:00
Noi
1fba7ff708 stopgap fixes 2023-03-04 11:27:31 -08:00
Noi
104d99856b Prevent unnecessary disconnection when user list fetch takes too long 2023-03-02 09:58:15 -08:00
Noi
4f22d4b991 Merge branch 'main' into cleanup 2022-11-22 23:40:48 -08:00
Noi
a3ac5d6ede Change data types from long to ulong 2022-11-22 23:19:37 -08:00
Noi
2c920e9794 Upgrade EFCore, switch to bulk operations 2022-11-21 21:20:48 -08:00
Noi
e62a89d0a0 Use background service semaphore
Must have missed it the first time...
2022-11-21 19:17:07 -08:00
Noi
e265cafd25 Fix incorrect value checked for determining moderator
The public instance will be updated with this fix immediately.
This fixes cases in which those with moderator roles are unable
to use mod-only commands as intended.
It also fixes a dangerous bug in which users with the birthday role
assigned to them have unrestricted access to moderator commands.
2022-10-10 14:27:54 -07:00
Noi
854cd0626b Remove unneeded TODOs
A better logging implementation is no longer planned for now, as the
current method has proven to be sufficient so far. It may even continue
to be so for a while.
2022-08-31 21:13:41 -07:00
Noi
12fe869b26 Style updates 2022-08-31 21:09:10 -07:00
Noi
b9604dadfe Remove text-based commands 2022-08-29 12:22:42 -07:00
Noi
31d5513c9e Reduce concurrent database operations in background services 2022-08-09 17:05:19 -07:00
Noi
400cc4bfbd Remove rate limit auto-retry 2022-03-30 21:51:44 -07:00
Noi
aebc63358d Check against configuring 'everyone' role 2022-03-30 13:35:56 -07:00
Noi
c0b2b9793b Add role removal limit per run 2022-03-23 11:13:55 -07:00
Noi
f4daa63bc5 Various fixes
- Fixed roles still not applying in certain occasions
- Suppressed several error messages during role updates
2022-03-22 12:33:33 -07:00
Noi
014b5a601d Increase log threshold for AutoUserDownload 2022-03-22 12:32:42 -07:00
Noi
3d4add3581 Update service exception handling
I didn't find the bug...
2022-03-22 00:08:40 -07:00
Noi
021def4f88 Fix roles not updating
Accidentally rewrote a handful of things while I was at it. The changes are staying.

After a long search, I found that this issue only shows itself if the bot is in several servers, encountering a valid configuration while it has yet to look at more servers (that is, a situation my debug bot is not in). The loop had been quitting halfway through for reasons seemingly beyond any logic or comprehension.

I already had a hunch that the query I wrote earlier was needlessly complex, as one might expect considering it was written during a state of delirium. It was easy to simplify it. I hoped that would be it, but no change occurred. On the contrary, some checks I slipped in there in the meantime were *passing*.

Further and further investigation finally revealed that the exception handler for background services doesn't actually do what it's expected to do. It's been silently dropping the exceptions that EF had been throwing this whole time, telling me quite plainly what the problem was and why it was quitting at a seemingly random spot.

The fix: Turns out the query evaluates during the foreach loop, which conflicts with wanting to do additional queries within it. Throwing a ToList() somewhere in it seems to have solved it.

These last few hours were quite the adventure...
My head hurts. Now I'm off to take a look at the exception handler.
2022-03-21 23:52:36 -07:00
Noi
2a1478fb0b Add log message 2022-03-21 23:33:24 -07:00
Noi
c280904cb8 Update services to use EF queries 2022-03-21 12:12:18 -07:00
Noi
b1b7c60211 Update commands to use EF queries 2022-03-20 01:07:17 -07:00
Noi
578f2545f2 Various changes
-Remove webhook logging references
--Including config line. Idea is abandoned for now.
-Remove unneeded comments
-Remove diagnostic messages
--Corresponding problems were solved by moving to dedicated hardware
-Update style on all affected files
2021-12-05 18:58:10 -08:00
Noi
3741222c68 Improve performance by placing updates in transaction 2021-12-05 18:29:27 -08:00
Noi
51e241aca8 Restore "most users downloaded" checks
Workaround to deal with continued instances of inconsistent Discord.Net user downloading behavior
2021-12-05 18:25:02 -08:00
Noi
5e4d030467 Rework member cache downloading
Fill it quicker when immediately needed, removing the need for a request list and all relating to it in the corresponding background service.

Additionally, updated usings, style, nullables in all affected files.
2021-11-22 13:40:08 -08:00
Noi
f8350fed53 Increase threshold, no longer stagger DataRetention
This staggering was most likely the cause of a major amount of data lost recently, in which certain guilds never had their values updated.
The staggering was meant to attempt to reduce load on a server with limited capabilities, and testing shows that it runs on more capable hardware without this issue when run this way.
2021-11-22 11:49:55 -08:00
Noi
800bba2193 Add more information to check command
Additionally, fix up null checks in affected files
2021-10-24 18:15:46 -07:00
Noi
0c56a0859a Replace test with check command
Removes some messy code as a result of the old feature's removal.
Additionally, updated code style in ManagerCommands and fixed several nullable issues.
2021-10-22 15:41:36 -07:00
Noi
6f34fbe657 Modified all background services
-Removed a number of diagnostic messages
-Removed ConnectionStatus, connection scores, etc.
-Modified work intervals for certain background tasks
-Updated code style
2021-10-14 18:55:04 -07:00
Noi
8cff530a7c Remove semaphore in SelectiveAutoUserDownload
Also updated style for this file.
Additionally, reworded the corresponding error message to something friendlier.
2021-10-13 21:36:00 -07:00
Noi
dcb9bfdd9a Apply suggestions from code analysis 2021-10-13 20:38:52 -07:00
Noi
57a870efda Additional diagnostic information 2021-10-13 19:28:00 -07:00
Noi
88c18c4364 Fix occasional internal ObjectDisposedException when disposing 2021-06-01 21:48:26 -07:00
Noi
59afd8ce3b Move server count reporting to be handled per-shard 2021-05-30 12:00:49 -07:00
Noi
a0571ce3d7 Add some leeway regarding incomplete user cache
Implemented several workarounds to what appearto be a library bug in
which not all users will be downloaded onto the cache. User cache
checking and downloading is delegated to a new Common method and a
new BackgroundService, respectively.
This is hopefully temporary.
2021-02-01 22:48:20 -08:00
Noi
1e8b47784d Modify DataRetention behavior; simplify SQL config 2021-02-01 22:03:50 -08:00
Noi
9667820df4 Reduce background work interval 2021-02-01 22:02:29 -08:00
Noi
3c73be3ee7 Automatically identify and remove dead shards
- Manager loop updated to act on dead shards and initialize new ones
- Initialization of new shards is now staggered in case of many shards
- Now using intents
- Adding a delay and a second connection check when downloading guild
  members. This has greatly improved stability over the previously
  attempted method.
- No longer sends guild counts to external sites until fully connected
2020-10-29 00:44:48 -07:00