Commit graph

99 commits

Author SHA1 Message Date
Adeodato Simó 8ac873419f
refactor: eagerly use a set in recipients, get_recipients 2024-01-26 06:29:59 -03:00
Adeodato Simó 31babdfa51
Always prefer shared inboxes when computing receipent lists
This avoids duplicate submissions to remote instances when mentioning
followers (i.e., `POST /user/foo/inbox` followed by `POST /inbox`, which
results in two separate `add_status` tasks, and might generate duplicates
in the target instance).
2024-01-26 06:18:02 -03:00
Victor Villas 8fd05004ea
Update page formatter on ordered collection 2023-12-03 20:03:33 -08:00
Joeri de Ruiter f07d7b02f1 Type annotations and related changes for bookwyrm.connectors 2023-07-28 17:43:32 +02:00
Wesley Aptekar-Cassels 3e78e398c0 Switch from priority queues to function-based queues
Fixes: #2907
2023-07-20 12:25:30 -04:00
Mouse Reeve a4ccd45537
Merge pull request #2812 from hughrun/gts
Fix federation with GoToSocial and inconsistent KeyId in headers
2023-05-29 19:54:00 -07:00
Hugh Rundle a0b7112c9c
Merge branch 'main' into gts 2023-04-14 18:24:02 +10:00
Hugh Rundle 8a8af4e909 fix tests and make pylint happier 2023-04-14 18:03:51 +10:00
Hugh Rundle 123628c66a fix tests and formatting 2023-04-13 22:33:54 +10:00
Hugh Rundle 56a062d01f pylint fixes 2023-04-13 20:21:35 +10:00
Hugh Rundle c7adb62831 make get_legacy_key more DRY 2023-04-13 19:48:20 +10:00
Hugh Rundle a6676718cb formatting 2023-04-13 13:27:51 +10:00
Hugh Rundle 03f21b0f35 Use correct keyId with legacy fallback
Bookwyrm keyIds are at `userpath/#main-key`, however when signing AP objects we have claimed in the headers that the keyId is at `userpath#main-key`.
This is incorrect, and makes GoToSocial's strict checking break.
Simply updating the signatures to use the correct KeyId breaks legacy Bookwyrm's signature checks, becuase it assumes that the keyId path is the same as the user path plus a fragment.
This commit allows for either option, by sending the request a second time with the incorrect keyId if sending with the correct one causes an error.
2023-04-11 15:45:06 +10:00
Wesley Aptekar-Cassels 1048638e30 Stop ignoring task results
This is essentially a revert of 9cbff312a. The commit was at the advice
of the Celery docs for optimization, but I've since decided that the
downsides in terms of making things harder to debug (it makes Flower
nearly useless, for instance) are bigger than the upsides in performance
gain (which seem extremely small in practice, given how long our tasks
take, and the number of tasks we have).
2023-04-07 21:51:44 -04:00
Josh Soref dfae27ca32 spelling: updated
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 9cddea11c7 spelling: paginate
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref c009f6e4df spelling: overridden
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 56f38c178c spelling: ordered
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 40632b2486 spelling: multiple
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 649c782782 spelling: inheritance
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 9cad11b2b3 spelling: deduplication
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 54285e4bcd spelling: auxiliary
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Wesley Aptekar-Cassels 9cbff312a5 Ignore Celery task results
Since we don't use the results of our Celery tasks (all of them return
None implicitly), it's prudent to set the ignore_result flag, for a
potential performance improvement. See the Celery docs for details [1].

We could do this with the global CELERY_IGNORE_RESULT setting, but it
offers more flexibility if we want to use task results in the future to
set it on a per-task basis.

[1]: https://docs.celeryq.dev/en/stable/userguide/tasks.html#ignore-results-you-don-t-want
2023-03-08 02:12:13 -05:00
Mouse Reeve b167364c5c Use a separate queue for broadcasts
I think this will go a long way to solve the federation delay problems
we're seeing on b.s. I'm not sure at what point adding more queues will
create more problems than it solves, but I do think in this case the
queues are out of balance and moving broadcasts (which are the most
common type of `medium_priority` task at the moment) to their own queue
will be an improvement.
2023-02-20 12:58:41 -08:00
Hugh Rundle d66e2fe861 merge in latest changes 2023-01-18 14:12:01 +11:00
Mouse Reeve ddcaf8e3b8 Use asyncio for broadcasting 2022-11-10 15:41:56 -08:00
Mouse Reeve cbb979242d
Revert "Use async requests for broadcasting" 2022-07-02 10:56:18 -07:00
Mouse Reeve c738eaa2c2 Use async requests for broadcasting
When an activity needs to be broadcast to the whole wide fediverse, the
number of requests can get enormous and the broadcast task ends up
taking ages to run. This change sends these requests out in one aiohttp
session, to improve performance.
2022-05-31 13:09:27 -07:00
Renato "Lond" Cerqueira 097d86454a Add signatures to requests to mastodon to support authorized fetch mode
When mastodon is in authorized fetch mode any request has to be signed
or it fails with 401. This adds the needed signature to the requests
made to discover the actor when receiving something from mastodon (such
as a follow request)
2022-01-05 15:46:42 +01:00
Mouse Reeve 9fee860b00 Adds enum for queue names 2021-11-11 19:10:22 -08:00
Mouse Reeve 6aa57d4d34 Set queue for broadcast task 2021-11-11 19:00:01 -08:00
Mouse Reeve cf477a03ae Corrects broadcast flow for objects 2021-11-10 10:39:51 -08:00
Mouse Reeve 97a71f5e39 Cleans up software check syntax 2021-11-10 09:55:56 -08:00
Mouse Reeve aeef472ee1 Fixes flow in checking software for broadcast 2021-11-10 09:33:00 -08:00
Mouse Reeve e19c4620ce Don't broadcast imported reviews outside bookwyrm 2021-11-08 12:00:08 -08:00
Mouse Reeve acfb1bb376 Updating string format synatx part 2 2021-09-18 11:32:00 -07:00
Mouse Reeve de3f18655c Set priorities on tasks 2021-09-07 16:33:43 -07:00
Mouse Reeve cb21099e0b Fixes serialization of delete activity 2021-09-06 12:00:10 -07:00
Mouse Reeve ae81d6cf71 More tests 2021-09-06 11:55:04 -07:00
Mouse Reeve 5640ae4f7e Handle deletions of ordered collections 2021-09-06 11:24:08 -07:00
Mouse Reeve 65e982e35b Uses more general requests exception 2021-08-08 18:13:02 -07:00
Mouse Reeve 88c23117ff Fixes outbox pagination 2021-07-07 10:56:19 -07:00
Mouse Reeve 3ade2d3bb1 New version of black, new whitespace 2021-04-26 09:15:42 -07:00
Mouse Reeve b457446f2f Don't save duplicate boosts 2021-04-22 19:36:27 -07:00
Mouse Reeve 9148f36719 Fixes duplicate boosts 2021-04-22 18:16:00 -07:00
Mouse Reeve db09ca4331 Adds last edited by to author 2021-04-22 07:51:06 -07:00
Mouse Reeve ae5e744731 Save last edited by user 2021-04-22 07:29:09 -07:00
Mouse Reeve 02e6602a0b Reject statuses from deactivated remote users 2021-04-17 17:55:22 -07:00
Mouse Reeve 8421a2e832 Clarifies logic in if statement 2021-04-17 15:14:23 -07:00
Mouse Reeve ebdbdc8790 Broadcast deletions 2021-04-17 13:19:23 -07:00