prefetch handle info instead of waiting for load
This commit is contained in:
parent
877b0e043b
commit
27b5bc5f5f
|
@ -252,6 +252,8 @@ func savexonk(user *WhatAbout, x *Honk) {
|
||||||
if strings.Contains(aud, user.URL) {
|
if strings.Contains(aud, user.URL) {
|
||||||
whofore = 1
|
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,
|
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)
|
x.Noise, x.Convoy, whofore, "html", x.Precis, x.Oonker, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
11
fun.go
11
fun.go
|
@ -376,6 +376,9 @@ var handlelock sync.Mutex
|
||||||
|
|
||||||
// handle, handle@host
|
// handle, handle@host
|
||||||
func handles(xid string) (string, string) {
|
func handles(xid string) (string, string) {
|
||||||
|
if xid == "" {
|
||||||
|
return "", ""
|
||||||
|
}
|
||||||
handlelock.Lock()
|
handlelock.Lock()
|
||||||
handle := allhandles[xid]
|
handle := allhandles[xid]
|
||||||
handlelock.Unlock()
|
handlelock.Unlock()
|
||||||
|
@ -415,6 +418,14 @@ func findhandle(xid string) string {
|
||||||
return handle
|
return handle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var handleprelock sync.Mutex
|
||||||
|
|
||||||
|
func prehandle(xid string) {
|
||||||
|
handleprelock.Lock()
|
||||||
|
defer handleprelock.Unlock()
|
||||||
|
handles(xid)
|
||||||
|
}
|
||||||
|
|
||||||
func prepend(s string, x []string) []string {
|
func prepend(s string, x []string) []string {
|
||||||
return append([]string{s}, x...)
|
return append([]string{s}, x...)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue