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

Improve responsiveness of spam checking #7

Merged
merged 4 commits into from
Feb 4, 2021
Merged

Improve responsiveness of spam checking #7

merged 4 commits into from
Feb 4, 2021

Conversation

Yoric
Copy link
Contributor

@Yoric Yoric commented Feb 4, 2021

  1. Now that we know that the IWF link list is short and easily fits into memory, we can preload it into a trie, removing the need for any kind of linkification or database access on the critical path.
  2. Once Add check_media_file_for_spam spam checker hook synapse#9311 has landed, we'll be able to use this new API to check files during upload/download rather than in the middle of message sending. This should keep things much more responsive for the critical path.

Yoric added 3 commits February 4, 2021 11:03
Now that we know that the list of URLs will easily fit in memory,
we can use a much faster trie-based approach.
…ending messages.

This should be much more responsive for users.
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Can you run black, isort and flake8 over this please? They're the standard linters and will make the module match the Synapse style guide

Otherwise looks good, mostly just tidying things up

synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
@Yoric Yoric requested a review from erikjohnston February 4, 2021 11:43
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

I think this looks good, but let's run make_automaton in a thread

synapse_spamcheck_badlist/bad_list_filter.py Outdated Show resolved Hide resolved
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.

2 participants