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

[feature] support canceling scheduled tasks, some federation API performance improvements #2329

Conversation

NyaaaWhatsUpDoc
Copy link
Member

@NyaaaWhatsUpDoc NyaaaWhatsUpDoc commented Nov 2, 2023

Description

  • wraps the scheduler to support easy job cancelling
  • copies over more of the required, (+ some niceties) logic changes from the ./internal/ap subpkg
  • copies over more of the required, (+ some niceties) from the ./internal/{federation,processing/workers} subpkgs
    • create status handling now entirely within fediapi handler (removes need for double Statusable->Status parsing)
    • supports create of multiple status objects
    • vastly reduces federatingDB.NewID() complexity

Checklist

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@@ -358,15 +357,6 @@ func (p *fediAPI) CreateAnnounce(ctx context.Context, fMsg messages.FromFediAPI)
return gtserror.Newf("db error inserting status: %w", err)
}

// Ensure boosted status ancestors dereferenced. We need at least
// the immediate parent (if present) to ascertain timelineability.
if err := p.federate.DereferenceStatusAncestors(ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this check still performed somewhere? I remember this being quite important to avoid seeing unwanted statuses (replies to blocked domains etc) in the timeline

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what you mean by check, as this is a dereference of status ancestors. Though it is something that will be handled by the DereferenceAnnounce function above, though I have just realized a quick tweak it might need now... I'll also add a note here explaining why we don't need to dereference ancestors, i.e. because it's handled within the DereferenceAnnounce() function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, sorry I wasn't very clear. What I meant was:

The below call to p.surface.timelineAndNotifyStatus will derive timelineability of the provided status, in part, from the visibility of the status's parent.

Previously, this call to p.federate.DereferenceStatusAncestors ensured that this status parent was set (if present) before the status gets passed into p.surface.timelineAndNotifyStatus, thus ensuring that it's not timelined if the parent is not visible for whatever reason.

By removing this synchronous call here to dereference the status's ancestors, you may be reintroducing a bug where statuses sometimes got timelined when they shouldn't (eg., the status is a boost of a reply to someone on a blocked domain).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahhhh gotcha. Makes sense. Will fix it :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated our RefreshStatus() and GetStatusByURI() fucntions to handle status parent dereferencing synchronously in the cases where they're dereferencing a new status :)

@tsmethurst
Copy link
Contributor

Looking good. Just not sure about the panicking!

@NyaaaWhatsUpDoc NyaaaWhatsUpDoc merged commit 41435a6 into superseriousbusiness:main Nov 4, 2023
@NyaaaWhatsUpDoc NyaaaWhatsUpDoc deleted the feature/new-scheduler-abound! branch November 4, 2023 20:21
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