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

[ModLog] Use custom scopes for ModLog Config #2766

Merged
merged 10 commits into from
Jun 25, 2019

Conversation

Tobotimus
Copy link
Member

@Tobotimus Tobotimus commented Jun 9, 2019

Modlog is currently the biggest culprit for seriously large documents in the MongoDB backend, since it stores all cases as nested dicts in the guild scope. So, for example, on the Fortnite server, the guild document for @Kowlin's bot has exceeded 8MB.

This PR gives each case its own document. It also does the same for casetypes. Not only does it remove the possibility of the document exceeding the maximum size in MongoDB, it's also just more efficient for all backends.

Other changes

Config Bug

These changes highlighted a bug in Config, which I've fixed here but will probably open a new PR for: when a custom scope uses more than one primary key, but does this with a partial primary key: conf.custom(SCOPE, primary_key_1).all(), the defaults will be mixed in with the top-level of the returned dict, even though the actual documents are nested further in.

General ModLog improvements

Fixed a bunch of type-hints, and also added more support for when an object related to a case (user, moderator, channel etc.) can't be found (because it was deleted or something rather)

@Tobotimus Tobotimus added Type: Enhancement Something meant to enhance existing Red features. V3 labels Jun 9, 2019
@mikeshardmind mikeshardmind added this to the 3.1.3 milestone Jun 11, 2019
@Kowlin
Copy link
Member

Kowlin commented Jun 21, 2019

PR seems to work, however I think that there is a migration failur, it cannot reference to old mod cases within the casesfor command, or continue its old count.

@Tobotimus
Copy link
Member Author

Thanks, will take a look at it later this afternoon.

@Kowlin Kowlin self-assigned this Jun 22, 2019
@Tobotimus Tobotimus added the Blocked By: Other PR Blocked by another PR. label Jun 23, 2019
@Tobotimus
Copy link
Member Author

This PR now depends on #2795

@mikeshardmind mikeshardmind removed the Blocked By: Other PR Blocked by another PR. label Jun 24, 2019
redbot/__main__.py Outdated Show resolved Hide resolved
Tobotimus and others added 3 commits June 24, 2019 17:04
Was previously doing it lexicographically, which is wrong.

Signed-off-by: Toby Harradine <[email protected]>
Copy link
Member

@Kowlin Kowlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is working as intended. Data is migrated over to custom handler and deleted from the modlog.guild as it should. Pulling back on old cases works, and continuity in modlog is working as intended.

@Tobotimus Tobotimus merged commit f91d861 into Cog-Creators:V3/develop Jun 25, 2019
@Tobotimus Tobotimus deleted the V3/modlog_config_redesign branch June 25, 2019 14:52
@Jackenmen Jackenmen added the Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants