-
Notifications
You must be signed in to change notification settings - Fork 53
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 polling reports in synapse #259
Conversation
48ace71
to
f328675
Compare
i think if we kept the polling delay at once-a-minute, using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use setInterval
. If the homeserver has a downtime, this can cause a thundering herd of requests when it returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing the PR description:
we already have a method for getting reports in to mjolnir by asking an nginx sitting in front of Synapse to redirect the report endpoint to mjolnir, but this seemed fiddly, specific to your reverse proxy, and on matrix.org we want reports to go in to both mjolnir and synapse, so for the time being we landed on this solution.
this polls synapse once a minute to grab any new reports and feeds them in to the same code flow that the reverse proxy intercepting method uses
Suggested changes
- Set out what the change does
- e.g. This change polls Synapse once per minute to grab new abuse reports from users, and pulls them into Mjolnir. This allows us to send the reports to both the Synapse database and to Mjolnir, which we need for matrix.org
- Set out the options you considered
- Using an nginx instance sitting in front of Synapse to reverse proxy the report endpoint to Mjolnir
- Polling Synapse to bring reports from Synapse to Mjolnir
- What the third choice was (rewriting how we handle reports iirc)
- Set out why you chose the option in this PR
- It's quick, not implementation specific, doesn't require a separate dependency in nginx
- Set out out the risks and potential problems with this choice
- We may need to rewrite how we handle reports anyway
- Polling may be slower than we need
- Polling may be more expensive than we want
- Making changes to the polling interval involves x
That pattern gives a future troubleshooter a bunch of context about why we are making this change, and the other options that we have considered and discarded. If we're hooking into other code flows, I'd maybe link those up too (such as the code flow for the existing implementation) — it's easy enough to find them, but in a 4am incident, any thinking we save ourselves is a victory! It also makes it easier if we're onboarding other folks onto the team, or if other teams are looking at this code in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting closer
b590096
to
8319861
Compare
ba4dc18
to
adccab6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
unsure of whether we need to give this a dedicated test, i believe it is possible #259 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you be surprised if I request tests? :)
39b4fe7
to
ee03759
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're almost there!
Lots of trivial nitpicks, because I'm me, and a couple of actual remarks hidden in the middle.
8dfb72b
to
bcf0f12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
A few nits here and there.
we already have a method for getting reports in to mjolnir by asking an nginx sitting in front of Synapse to redirect the report endpoint to mjolnir, but this seemed fiddly, specific to your reverse proxy, and on matrix.org we want reports to go in to both mjolnir and synapse, so for the time being we landed on this solution.
this polls synapse once a minute to grab any new reports and feeds them in to the same code flow that the reverse proxy intercepting method uses