all repos — honk @ 5e42067c8b5faa9837f1a9788646e5103e1d91c8

my fork of honk

don't need to retry low prio communications
Ted Unangst tedu@tedunangst.com
Tue, 29 Sep 2020 21:16:07 -0400
commit

5e42067c8b5faa9837f1a9788646e5103e1d91c8

parent

f9745daafdb0dbd68708e59cd9cd1122b6827d89

3 files changed, 25 insertions(+), 11 deletions(-)

jump to
M activity.goactivity.go

@@ -997,7 +997,7 @@ j["to"] = actor

j["published"] = time.Now().UTC().Format(time.RFC3339) j["object"] = req - deliverate(0, user.ID, actor, j.ToBytes()) + deliverate(0, user.ID, actor, j.ToBytes(), true) } func itakeitallback(user *WhatAbout, xid string, owner string, folxid string) {

@@ -1016,7 +1016,7 @@ f["object"] = xid

j["object"] = f j["published"] = time.Now().UTC().Format(time.RFC3339) - deliverate(0, user.ID, owner, j.ToBytes()) + deliverate(0, user.ID, owner, j.ToBytes(), true) } func subsub(user *WhatAbout, xid string, owner string, folxid string) {

@@ -1033,7 +1033,7 @@ j["to"] = owner

j["object"] = xid j["published"] = time.Now().UTC().Format(time.RFC3339) - deliverate(0, user.ID, owner, j.ToBytes()) + deliverate(0, user.ID, owner, j.ToBytes(), true) } func activatedonks(donks []*Donk) []junk.Junk {

@@ -1340,7 +1340,7 @@

rcpts := make(map[string]bool) rcpts[ch.Target] = true for a := range rcpts { - go deliverate(0, user.ID, a, msg) + go deliverate(0, user.ID, a, msg, true) } }

@@ -1375,13 +1375,25 @@ }

} } for a := range rcpts { - go deliverate(0, user.ID, a, msg) + go deliverate(0, user.ID, a, msg, doesitmatter(honk.What)) } if honk.Public && len(honk.Onts) > 0 { collectiveaction(honk) } } +func doesitmatter(what string) bool { + switch what { + case "ack": + return false + case "react": + return false + case "deack": + return false + } + return true +} + func collectiveaction(honk *Honk) { user := getserveruser() for _, ont := range honk.Onts {

@@ -1408,7 +1420,7 @@ }

} msg := j.ToBytes() for a := range rcpts { - go deliverate(0, user.ID, a, msg) + go deliverate(0, user.ID, a, msg, false) } } }

@@ -1708,7 +1720,7 @@ rcpts[f.XID] = true

} } for a := range rcpts { - go deliverate(0, user.ID, a, msg) + go deliverate(0, user.ID, a, msg, false) } }
M deliverator.godeliverator.go

@@ -72,7 +72,7 @@ }

var garage = gate.NewLimiter(40) -func deliverate(goarounds int64, userid int64, rcpt string, msg []byte) { +func deliverate(goarounds int64, userid int64, rcpt string, msg []byte, prio bool) { garage.Start() defer garage.Finish()

@@ -99,7 +99,9 @@ }

err := PostMsg(ki.keyname, ki.seckey, inbox, msg) if err != nil { log.Printf("failed to post json to %s: %s", inbox, err) - sayitagain(goarounds+1, userid, rcpt, msg) + if prio { + sayitagain(goarounds+1, userid, rcpt, msg) + } return } }

@@ -162,7 +164,7 @@ log.Printf("error deleting doover: %s", err)

continue } log.Printf("redeliverating %s try %d", rcpt, goarounds) - deliverate(goarounds, userid, rcpt, msg) + deliverate(goarounds, userid, rcpt, msg, true) } else if d.When.Before(nexttime) { nexttime = d.When }
M web.goweb.go

@@ -2287,7 +2287,7 @@ public := r.FormValue("public") == "1"

rcpts := boxuprcpts(user, r.Form["rcpt"], public) msg := []byte(r.FormValue("msg")) for rcpt := range rcpts { - go deliverate(0, userid, rcpt, msg) + go deliverate(0, userid, rcpt, msg, true) } default: http.Error(w, "unknown action", http.StatusNotFound)