revert previous, no need for pummeling
Ted Unangst tedu@tedunangst.com
Mon, 22 Jan 2024 17:22:17 -0500
1 files changed,
4 insertions(+),
24 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -28,7 +28,6 @@ "net/http"
"os" "regexp" "strings" - "sync" "time" "humungus.tedunangst.com/r/webs/gate"@@ -903,7 +902,6 @@ return nil
} numatts := 0 - var donkfns []func() *Donk procatt := func(att junk.Junk) { at, _ := att.GetString("type") mt, _ := att.GetString("mediaType")@@ -967,10 +965,11 @@ }
if preferorig && !localize { return } + donk := savedonk(u, name, desc, mt, localize) + if donk != nil { + xonk.Donks = append(xonk.Donks, donk) + } numatts++ - donkfns = append(donkfns, func() *Donk { - return savedonk(u, name, desc, mt, localize) - }) } if img, ok := obj.GetMap("image"); ok { procatt(img)@@ -998,11 +997,6 @@ ilog.Printf("attachment that wasn't map?")
continue } procatt(att) - } - } - for _, donk := range multiRun(donkfns) { - if donk != nil { - xonk.Donks = append(xonk.Donks, donk) } } proctag := func(tag junk.Junk) {@@ -2110,17 +2104,3 @@ elog.Printf("error updating honker: %s", err)
return } } - -func multiRun[R any](fns []func() R) []R { - results := make([]R, len(fns)) - var wg sync.WaitGroup - for i, fn := range fns { - wg.Add(1) - go func(i int, fn func() R) { - results[i] = fn() - wg.Done() - }(i, fn) - } - wg.Wait() - return results -}