logging, gitignore, pin rns

This commit is contained in:
blankie 2026-07-03 02:25:03 +00:00
parent decefb89d5
commit a70d0db0bd
3 changed files with 10 additions and 3 deletions

4
.gitignore vendored
View file

@ -7,3 +7,7 @@ dist/
*.db-shm *.db-shm
*.db-wal *.db-wal
.env .env
*.log
.DS_Store
.pytest_cache/
.coverage

View file

@ -9,7 +9,7 @@ description = "Decentralized link-sharing forum for TinyWeb"
license = {text = "AGPL-3.0-only"} license = {text = "AGPL-3.0-only"}
requires-python = ">=3.9" requires-python = ">=3.9"
dependencies = [ dependencies = [
"rns", "rns>=0.8.0",
] ]
[project.optional-dependencies] [project.optional-dependencies]

View file

@ -1,9 +1,12 @@
import json import json
import logging
import random import random
import threading import threading
import time import time
import RNS import RNS
logger = logging.getLogger(__name__)
from tinyweb_forum.bloom import BloomFilter from tinyweb_forum.bloom import BloomFilter
FORUM_APP = "tinyweb-forum" FORUM_APP = "tinyweb-forum"
@ -105,7 +108,7 @@ class ForumSync:
count += 1 count += 1
except Exception as e: except Exception as e:
self.fdb.record_sync_result(inst["instance_hash"], False) 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 return count
def _start_sync_loop(self): def _start_sync_loop(self):
@ -153,7 +156,7 @@ class ForumSync:
self._sync_with(inst["instance_hash"], my_topics) self._sync_with(inst["instance_hash"], my_topics)
except Exception as e: except Exception as e:
self.fdb.record_sync_result(inst["instance_hash"], False) 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: except Exception:
pass pass
prune_counter += 1 prune_counter += 1