all messages matter again

This commit is contained in:
Ted Unangst 2023-06-12 13:44:03 -04:00
parent 3ff98a261e
commit 6e43340381
3 changed files with 11 additions and 25 deletions

View File

@ -1149,7 +1149,7 @@ func rubadubdub(user *WhatAbout, req junk.Junk) {
j["published"] = time.Now().UTC().Format(time.RFC3339) j["published"] = time.Now().UTC().Format(time.RFC3339)
j["object"] = req j["object"] = req
deliverate(0, user.ID, actor, j.ToBytes(), true) deliverate(0, user.ID, actor, j.ToBytes())
} }
func itakeitallback(user *WhatAbout, xid string, owner string, folxid string) { func itakeitallback(user *WhatAbout, xid string, owner string, folxid string) {
@ -1168,7 +1168,7 @@ func itakeitallback(user *WhatAbout, xid string, owner string, folxid string) {
j["object"] = f j["object"] = f
j["published"] = time.Now().UTC().Format(time.RFC3339) j["published"] = time.Now().UTC().Format(time.RFC3339)
deliverate(0, user.ID, owner, j.ToBytes(), true) deliverate(0, user.ID, owner, j.ToBytes())
} }
func subsub(user *WhatAbout, xid string, owner string, folxid string) { func subsub(user *WhatAbout, xid string, owner string, folxid string) {
@ -1185,7 +1185,7 @@ func subsub(user *WhatAbout, xid string, owner string, folxid string) {
j["object"] = xid j["object"] = xid
j["published"] = time.Now().UTC().Format(time.RFC3339) j["published"] = time.Now().UTC().Format(time.RFC3339)
deliverate(0, user.ID, owner, j.ToBytes(), true) deliverate(0, user.ID, owner, j.ToBytes())
} }
func activatedonks(donks []*Donk) []junk.Junk { func activatedonks(donks []*Donk) []junk.Junk {
@ -1495,7 +1495,7 @@ func sendchonk(user *WhatAbout, ch *Chonk) {
rcpts := make(map[string]bool) rcpts := make(map[string]bool)
rcpts[ch.Target] = true rcpts[ch.Target] = true
for a := range rcpts { for a := range rcpts {
go deliverate(0, user.ID, a, msg, true) go deliverate(0, user.ID, a, msg)
} }
} }
@ -1534,25 +1534,13 @@ func honkworldwide(user *WhatAbout, honk *Honk) {
} }
} }
for a := range rcpts { for a := range rcpts {
go deliverate(0, user.ID, a, msg, doesitmatter(honk.What)) go deliverate(0, user.ID, a, msg)
} }
if honk.Public && len(honk.Onts) > 0 { if honk.Public && len(honk.Onts) > 0 {
collectiveaction(honk) 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) { func collectiveaction(honk *Honk) {
user := getserveruser() user := getserveruser()
for _, ont := range honk.Onts { for _, ont := range honk.Onts {
@ -1579,7 +1567,7 @@ func collectiveaction(honk *Honk) {
} }
msg := j.ToBytes() msg := j.ToBytes()
for a := range rcpts { for a := range rcpts {
go deliverate(0, user.ID, a, msg, false) go deliverate(0, user.ID, a, msg)
} }
} }
} }
@ -1893,7 +1881,7 @@ func updateMe(username string) {
} }
} }
for a := range rcpts { for a := range rcpts {
go deliverate(0, user.ID, a, msg, false) go deliverate(0, user.ID, a, msg)
} }
} }

View File

@ -71,7 +71,7 @@ func clearoutbound(rcpt string) {
var garage = gate.NewLimiter(40) var garage = gate.NewLimiter(40)
func deliverate(goarounds int64, userid int64, rcpt string, msg []byte, prio bool) { func deliverate(goarounds int64, userid int64, rcpt string, msg []byte) {
garage.Start() garage.Start()
defer garage.Finish() defer garage.Finish()
@ -98,9 +98,7 @@ func deliverate(goarounds int64, userid int64, rcpt string, msg []byte, prio boo
err := PostMsg(ki.keyname, ki.seckey, inbox, msg) err := PostMsg(ki.keyname, ki.seckey, inbox, msg)
if err != nil { if err != nil {
ilog.Printf("failed to post json to %s: %s", inbox, err) ilog.Printf("failed to post json to %s: %s", inbox, err)
if prio { sayitagain(goarounds+1, userid, rcpt, msg)
sayitagain(goarounds+1, userid, rcpt, msg)
}
return return
} }
} }
@ -163,7 +161,7 @@ func redeliverator() {
continue continue
} }
ilog.Printf("redeliverating %s try %d", rcpt, goarounds) ilog.Printf("redeliverating %s try %d", rcpt, goarounds)
deliverate(goarounds, userid, rcpt, msg, true) deliverate(goarounds, userid, rcpt, msg)
} else if d.When.Before(nexttime) { } else if d.When.Before(nexttime) {
nexttime = d.When nexttime = d.When
} }

2
web.go
View File

@ -2422,7 +2422,7 @@ func apihandler(w http.ResponseWriter, r *http.Request) {
rcpts := boxuprcpts(user, r.Form["rcpt"], public) rcpts := boxuprcpts(user, r.Form["rcpt"], public)
msg := []byte(r.FormValue("msg")) msg := []byte(r.FormValue("msg"))
for rcpt := range rcpts { for rcpt := range rcpts {
go deliverate(0, userid, rcpt, msg, true) go deliverate(0, userid, rcpt, msg)
} }
case "gethonkers": case "gethonkers":
j := junk.New() j := junk.New()