This commit is contained in:
Ted Unangst 2022-05-27 13:47:13 -04:00
commit f91f225030
1 changed files with 6 additions and 3 deletions

9
fun.go
View File

@ -635,14 +635,13 @@ func ziggy(userid int64) *KeyInfo {
var zaggies = cache.New(cache.Options{Filler: func(keyname string) (httpsig.PublicKey, bool) { var zaggies = cache.New(cache.Options{Filler: func(keyname string) (httpsig.PublicKey, bool) {
data := getxonker(keyname, "pubkey") data := getxonker(keyname, "pubkey")
if data == "" { if data == "" {
var key httpsig.PublicKey
dlog.Printf("hitting the webs for missing pubkey: %s", keyname) dlog.Printf("hitting the webs for missing pubkey: %s", keyname)
j, err := GetJunk(serverUID, keyname) j, err := GetJunk(serverUID, keyname)
if err != nil { if err != nil {
ilog.Printf("error getting %s pubkey: %s", keyname, err) ilog.Printf("error getting %s pubkey: %s", keyname, err)
when := time.Now().UTC().Format(dbtimeformat) when := time.Now().UTC().Format(dbtimeformat)
stmtSaveXonker.Exec(keyname, "failed", "pubkey", when) stmtSaveXonker.Exec(keyname, "failed", "pubkey", when)
return key, true return httpsig.PublicKey{}, true
} }
allinjest(originate(keyname), j) allinjest(originate(keyname), j)
data = getxonker(keyname, "pubkey") data = getxonker(keyname, "pubkey")
@ -650,9 +649,13 @@ var zaggies = cache.New(cache.Options{Filler: func(keyname string) (httpsig.Publ
ilog.Printf("key not found after ingesting") ilog.Printf("key not found after ingesting")
when := time.Now().UTC().Format(dbtimeformat) when := time.Now().UTC().Format(dbtimeformat)
stmtSaveXonker.Exec(keyname, "failed", "pubkey", when) stmtSaveXonker.Exec(keyname, "failed", "pubkey", when)
return key, true return httpsig.PublicKey{}, true
} }
} }
if data == "failed" {
ilog.Printf("lookup previously failed key %s", keyname)
return httpsig.PublicKey{}, true
}
_, key, err := httpsig.DecodeKey(data) _, key, err := httpsig.DecodeKey(data)
if err != nil { if err != nil {
ilog.Printf("error decoding %s pubkey: %s", keyname, err) ilog.Printf("error decoding %s pubkey: %s", keyname, err)