AV-98-fork

A fork of https://tildegit.org/solderpunk/AV-98
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 545d5f917d6f12a61d5156b486be58927038516e
parent f45630450f6e7780de4b03c039beae98877e6bb6
Author: Solderpunk <solderpunk@sdf.org>
Date:   Tue,  1 Sep 2020 21:14:17 +0200

Count cache hits in black box output.

Diffstat:
Mav98.py | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/av98.py b/av98.py @@ -288,6 +288,7 @@ class GeminiClient(cmd.Cmd): "refused_connections": 0, "reset_connections": 0, "timeouts": 0, + "cache_hits": 0, } self._connect_to_tofu_db() @@ -679,6 +680,7 @@ you'll be able to transparently follow links to Gopherspace!""") def _get_cached(self, url): mime, filename = self.cache[url] + self.log["cache_hits"] += 1 if mime.startswith("text/gemini"): with open(filename, "r") as fp: body = fp.read() @@ -1547,6 +1549,7 @@ current gemini browsing session.""" lines.append(("Timeouts:", self.log["timeouts"])) lines.append(("Refused connections:", self.log["refused_connections"])) lines.append(("Reset connections:", self.log["reset_connections"])) + lines.append(("Cache hits:", self.log["cache_hits"])) # Print for key, value in lines: print(key.ljust(24) + str(value).rjust(8))