diff --git a/.gitignore b/.gitignore index 8f46079..32440b2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ dist/ *.db-shm *.db-wal .env +*.log +.DS_Store +.pytest_cache/ +.coverage diff --git a/pyproject.toml b/pyproject.toml index c164407..67c620c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "Decentralized link-sharing forum for TinyWeb" license = {text = "AGPL-3.0-only"} requires-python = ">=3.9" dependencies = [ - "rns", + "rns>=0.8.0", ] [project.optional-dependencies] diff --git a/tinyweb_forum/sync.py b/tinyweb_forum/sync.py index e27b763..93f06b9 100644 --- a/tinyweb_forum/sync.py +++ b/tinyweb_forum/sync.py @@ -1,9 +1,12 @@ import json +import logging import random import threading import time import RNS +logger = logging.getLogger(__name__) + from tinyweb_forum.bloom import BloomFilter FORUM_APP = "tinyweb-forum" @@ -105,7 +108,7 @@ class ForumSync: count += 1 except Exception as e: self.fdb.record_sync_result(inst["instance_hash"], False) - print(f"[forum] sync error with {inst['instance_hash'][:16]}: {e}") + logger.error("sync error with %s: %s", inst["instance_hash"][:16], e) return count def _start_sync_loop(self): @@ -153,7 +156,7 @@ class ForumSync: self._sync_with(inst["instance_hash"], my_topics) except Exception as e: self.fdb.record_sync_result(inst["instance_hash"], False) - print(f"[forum] sync error with {inst['instance_hash'][:16]}: {e}") + logger.error("sync error with %s: %s", inst["instance_hash"][:16], e) except Exception: pass prune_counter += 1