all repos — honk @ 32f5b6b4ebda692969ce1a233beed19aee663911

my fork of honk

prefetch handle info instead of waiting for load
Ted Unangst tedu@tedunangst.com
Sun, 18 Aug 2019 18:32:44 -0400
commit

32f5b6b4ebda692969ce1a233beed19aee663911

parent

e185ba1652480c4c19966ebde18adf2ba0c86890

2 files changed, 13 insertions(+), 0 deletions(-)

jump to
M activity.goactivity.go

@@ -252,6 +252,8 @@ whofore := 0

if strings.Contains(aud, user.URL) { whofore = 1 } + go prehandle(x.Honker) + go prehandle(x.Oonker) res, err := stmtSaveHonk.Exec(x.UserID, x.What, x.Honker, x.XID, x.RID, dt, x.URL, aud, x.Noise, x.Convoy, whofore, "html", x.Precis, x.Oonker, 0) if err != nil {
M fun.gofun.go

@@ -376,6 +376,9 @@ var handlelock sync.Mutex

// handle, handle@host func handles(xid string) (string, string) { + if xid == "" { + return "", "" + } handlelock.Lock() handle := allhandles[xid] handlelock.Unlock()

@@ -413,6 +416,14 @@ log.Printf("error saving handle: %s", err)

} } return handle +} + +var handleprelock sync.Mutex + +func prehandle(xid string) { + handleprelock.Lock() + defer handleprelock.Unlock() + handles(xid) } func prepend(s string, x []string) []string {