Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Entity Framework for all database usage #20

Merged
merged 19 commits into from Mar 23, 2022

Conversation

NoiTheCat
Copy link
Owner

This deprecates all existing code under Data. Services have been rewritten to generate more efficient queries for their tasks, and all application commands have been at least partially rewritten to make use of this new setup.

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.
I didn't find the bug...
- Fixed roles still not applying in certain occasions
- Suppressed several error messages during role updates
@NoiTheCat NoiTheCat merged commit 8fb7ee9 into main Mar 23, 2022
@NoiTheCat NoiTheCat deleted the dev/database-revamp branch March 23, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant