mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[performance] cache mute check results (#4202)
This separates our the user mute handling from the typeconverter code, and creates a new "mutes" filter type (in a similar vein to the visibility filter) subpkg with its own result cache. This is a heavy mix of both chore given that mute calculation shouldn't have been handled in the conversion to frontend API types, and a performance bonus since we don't need to load and calculate so many things each time, just the single result each time with all necessary invalidation handled by database cache hooks. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4202 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
@ -1010,10 +1010,17 @@ func (p *fediAPI) UpdateStatus(ctx context.Context, fMsg *messages.FromFediAPI)
|
||||
}
|
||||
}
|
||||
|
||||
// Notify of the latest edit.
|
||||
if editsLen := len(status.EditIDs); editsLen != 0 {
|
||||
editID := status.EditIDs[editsLen-1]
|
||||
if err := p.surface.notifyStatusEdit(ctx, status, editID); err != nil {
|
||||
if len(status.EditIDs) > 0 {
|
||||
// Ensure edits are fully populated for this status before anything.
|
||||
if err := p.surface.State.DB.PopulateStatusEdits(ctx, status); err != nil {
|
||||
log.Error(ctx, "error populating updated status edits: %v")
|
||||
|
||||
// Then send notifications of a status edit
|
||||
// to any local interactors of the status.
|
||||
} else if err := p.surface.notifyStatusEdit(ctx,
|
||||
status,
|
||||
status.Edits[len(status.Edits)-1], // latest
|
||||
); err != nil {
|
||||
log.Errorf(ctx, "error notifying status edit: %v", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user