From e3aac28acc5e776107c94c01a88bbd577380d6c5 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Sun, 24 Jan 2021 12:12:13 -0800 Subject: more caching progress --- main.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index e9cdb2f..874dc4d 100644 --- a/main.go +++ b/main.go @@ -339,7 +339,7 @@ func main() { resp, err := http.DefaultClient.Do(req) - CheckError(err, "error with post form resp") + CheckError(err, "error with post form resp") defer resp.Body.Close() @@ -581,7 +581,6 @@ func main() { CheckError(err, "error getting actor from body in new board") //update board list with new instances following - fmt.Println(resp.StatusCode) if resp.StatusCode == 200 { var board []ObjectBase var item ObjectBase @@ -751,8 +750,6 @@ func main() { actor := GetActorFromPath(db, id, "/") _, auth := GetPasswordFromSession(r) - fmt.Println(actor.Id) - if id == "" || auth == "" { w.WriteHeader(http.StatusBadRequest) w.Write([]byte("")) @@ -1387,11 +1384,14 @@ func IsObjectLocal(db *sql.DB, id string) bool { query := `select id from activitystream where id=$1` - rows, err := db.Query(query, id) + rows, _ := db.Query(query, id) + var nID string defer rows.Close() - - if err != nil { + rows.Next() + rows.Scan(&nID) + + if nID == "" { return false } @@ -1401,15 +1401,18 @@ func IsObjectLocal(db *sql.DB, id string) bool { func IsObjectCached(db *sql.DB, id string) bool { query := `select id from cacheactivitystream where id=$1` - rows, err := db.Query(query, id) + rows, _ := db.Query(query, id) + var nID string defer rows.Close() - - if err != nil { + rows.Next() + rows.Scan(&nID) + + if nID == "" { return false } - return true + return true } func GetObjectFromActivity(activity Activity) ObjectBase { @@ -1555,8 +1558,6 @@ func MakeActivityRequest(activity Activity) { for _, e := range activity.To { - fmt.Println(e) - actor := GetActor(e) if actor.Inbox != "" { -- cgit v1.2.3