Quit AP goroutine early when there's no "to"

Previously, we'd sleep for 2 seconds and then return for no reason. This
fixes that.
This commit is contained in:
Matt Baer 2020-01-27 09:19:12 -05:00
parent 8d3e755c8f
commit bf8dcff01e
1 changed files with 5 additions and 4 deletions

View File

@ -388,6 +388,11 @@ func handleFetchCollectionInbox(app *App, w http.ResponseWriter, r *http.Request
}
go func() {
if to == nil {
log.Error("No to! %v", err)
return
}
time.Sleep(2 * time.Second)
am, err := a.Serialize()
if err != nil {
@ -396,10 +401,6 @@ func handleFetchCollectionInbox(app *App, w http.ResponseWriter, r *http.Request
}
am["@context"] = []string{activitystreams.Namespace}
if to == nil {
log.Error("No to! %v", err)
return
}
err = makeActivityPost(app.cfg.App.Host, p, fullActor.Inbox, am)
if err != nil {
log.Error("Unable to make activity POST: %v", err)