aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2022-06-18 11:10:46 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commite13f8001c69375a83efd3ff1bedb367b6851226a (patch)
tree2b6eea832d5b81531f714ade81dfab433f7174a9
parent54a0578dbc5eb65cd84ec1a67b2b36a4fbfb73ee (diff)
dont wait for inbox request to redirect user. prevents uneeded hang after post
-rw-r--r--main.go3
-rw-r--r--route/routes/actor.go1
-rw-r--r--route/util.go22
3 files changed, 16 insertions, 10 deletions
diff --git a/main.go b/main.go
index e472762..837fec5 100644
--- a/main.go
+++ b/main.go
@@ -31,6 +31,9 @@ func main() {
app := fiber.New(fiber.Config{
AppName: "FChannel",
Views: template,
+ ReadTimeout: 30 * time.Second,
+ WriteTimeout: 30 * time.Second,
+ IdleTimeout: 60 * time.Second,
ServerHeader: "FChannel/" + config.InstanceName,
})
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