From 8886e78b8c6ea5b68584f2c294fa8249731761b5 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 15 Aug 2019 23:38:01 -0400 Subject: [PATCH] better handle lookup that doesn't keep hammering failures --- fun.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fun.go b/fun.go index b813f77..d15c58f 100644 --- a/fun.go +++ b/fun.go @@ -379,15 +379,23 @@ func handles(xid string) (string, string) { row := stmtGetXonker.QueryRow(xid, "handle") var handle string err := row.Scan(&handle) - if err == nil { - return handle, handle + "@" + originate(xid) + if err != nil { + p := investigate(xid) + if p == nil { + m := re_unurl.FindStringSubmatch(xid) + if len(m) > 2 { + handle = m[2] + } else { + handle = xid + } + } else { + handle = p.Handle + } + stmtSaveXonker.Exec(xid, handle, "handle") } - p := investigate(xid) - if p == nil { + if handle == xid { return xid, xid } - handle = p.Handle - stmtSaveXonker.Exec(xid, handle, "handle") return handle, handle + "@" + originate(xid) }