Skip to content

Commit

Permalink
Code review changes part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mchavez committed Sep 3, 2024
1 parent 6b54a7f commit 89c5a32
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions pkg/uhttp/dbcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,29 +521,3 @@ func (d *DBCache) getStats(ctx context.Context) (Stats, error) {
Misses: int64(misses),
}, nil
}

// Len computes number of entries in cache.
func (d *DBCache) len(ctx context.Context) (int, error) {
var count int = 0
if d.IsNilConnection() {
return -1, fmt.Errorf("%s", nilConnection)
}

l := ctxzap.Extract(ctx)
rows, err := d.db.QueryContext(ctx, `SELECT count(*) FROM http_cache`)
if err != nil {
l.Debug(errQueryingTable, zap.Error(err))
return -1, err
}

defer rows.Close()
for rows.Next() {
err = rows.Scan(&count)
if err != nil {
l.Debug("Failed to scan rows from table", zap.Error(err))
return -1, err
}
}

return count, nil
}

0 comments on commit 89c5a32

Please sign in to comment.