From e13f8001c69375a83efd3ff1bedb367b6851226a Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 18 Jun 2022 11:10:46 -0700 Subject: dont wait for inbox request to redirect user. prevents uneeded hang after post --- route/routes/actor.go | 1 - route/util.go | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'route') diff --git a/route/routes/actor.go b/route/routes/actor.go index c35e57a..28c81e3 100644 --- a/route/routes/actor.go +++ b/route/routes/actor.go @@ -332,7 +332,6 @@ func MakeActorPost(ctx *fiber.Ctx) error { body, _ := ioutil.ReadAll(resp.Body) if resp.StatusCode == 200 { - var obj activitypub.ObjectBase obj = post.ParseOptions(ctx, obj) diff --git a/route/util.go b/route/util.go index 74926b4..1b0eee7 100644 --- a/route/util.go +++ b/route/util.go @@ -150,17 +150,21 @@ func ParseOutboxRequest(ctx *fiber.Ctx, actor activitypub.Actor) error { } } - activity, err := nObj.CreateActivity("Create") - if err != nil { - return util.MakeError(err, "ParseOutboxRequest") - } + go func(nObj activitypub.ObjectBase) { + activity, err := nObj.CreateActivity("Create") + if err != nil { + config.Log.Printf("ParseOutboxRequest Create Activity: %s", err) + } - activity, err = activity.AddFollowersTo() - if err != nil { - return util.MakeError(err, "ParseOutboxRequest") - } + activity, err = activity.AddFollowersTo() + if err != nil { + config.Log.Printf("ParseOutboxRequest Add FollowersTo: %s", err) + } - go activity.MakeRequestInbox() + if err := activity.MakeRequestInbox(); err != nil { + config.Log.Printf("ParseOutboxRequest MakeRequestInbox: %s", err) + } + }(nObj) var id string op := len(nObj.InReplyTo) - 1 -- cgit v1.2.3