gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app
Brian Campbell 2d12948220
Fix idempotency when database writes are slow (#21840)
There is an idempotency key generated by clients when authoring a post,
and stored in Redis, to ensure that if a user or client retries posting
the same status, we don't get a duplicate.

Hachyderm.io has been experiencing some filesystem and database
performance issues, causing database writes to be slow. This can mean
that there are successful posts, but the reverse proxy returns 504
Gateway Timeout before the idempotency status has been updated; users or
clients who retry (such as Tusky which retries automatically, see
tuskyapp/Tusky#2951) can re-try the same post with the same idempotency
key before it has actually been recorded in Redis, leading to duplicate
posts.

To address this issue, move all of the database updates after the
initial transaction that creates the status into the
`postprocess_status!` method, so we can insert the idempotency key
immediately after the status has been created, significantly reducing
the window in which the status could be created but the idempotency key
not yet stored.

Note: this has not yet been tested; I'm submitting this PR for
discussion and to offer to the Hachyderm.io admins to try out to fix the
multiple posting problem.

Co-authored-by: Brian Campbell <brcampbell@beta.team>
2022-12-15 18:08:40 +01:00
..
chewy Change algorithm of `tootctl search deploy` to improve performance (#18463) 2022-05-22 22:16:43 +02:00
controllers Fix changing domain block severity not undoing individual account effects (#22135) 2022-12-15 17:45:02 +01:00
helpers Fix attachment rendering of edited posts in OpenGraph (#22270) 2022-12-15 17:41:20 +01:00
javascript Fix being stuck in edit mode when deleting the edited status (#22126) 2022-12-15 17:47:43 +01:00
lib Fix inability to use local LibreTranslate without setting ALLOWED_PRIVATE_ADDRESSES (#21926) 2022-12-15 17:04:38 +01:00
mailers Add single splat to callback method definitions to avoid ArgumentError (#22246) 2022-12-13 20:03:16 +01:00
models Add "disabled" user filter for admin/accounts UI (#21282) 2022-12-15 17:30:47 +01:00
policies Fix getting a single EmailDomainBlock (#20846) 2022-11-17 10:55:50 +01:00
presenters Change sign-in banner to reflect disabled or moved account status (#19773) 2022-11-05 18:28:13 +01:00
serializers Fix punycoded local domains not being prettified in initial state (#21440) 2022-12-15 17:05:40 +01:00
services Fix idempotency when database writes are slow (#21840) 2022-12-15 18:08:40 +01:00
validators Fix error when uploading malformed CSV import (#19509) 2022-10-28 23:30:44 +02:00
views Add "disabled" user filter for admin/accounts UI (#21282) 2022-12-15 17:30:47 +01:00
workers Fix typos in source documentation (#21046) 2022-12-15 15:57:26 +01:00