From 03a2fa1d778db7708abf068b728cb28baa531bda Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:28:12 +0200 Subject: [PATCH] fixes wot option --- .idea/dvm.iml | 2 +- .idea/misc.xml | 2 +- nostr_dvm/tasks/content_discovery_update_db_only.py | 5 ++++- setup.py | 2 +- tests/discovery.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.idea/dvm.iml b/.idea/dvm.iml index 3b7bb0d..3c35999 100644 --- a/.idea/dvm.iml +++ b/.idea/dvm.iml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ddb297d..83b7974 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index aa9e55a..6a54d55 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -8,7 +8,7 @@ from itertools import islice import networkx as nx from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, NostrDatabase, \ ClientBuilder, Filter, NegentropyOptions, NegentropyDirection, init_logger, LogLevel, Event, EventId, Kind, \ - RelayLimits + RelayLimits, RelayFilteringMode from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils import definitions @@ -132,11 +132,14 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface): try: relaylimits = RelayLimits.disable() opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT))).relay_limits(relaylimits) + if self.dvm_config.WOT_FILTERING: + opts = opts.filtering_mode(RelayFilteringMode.WHITELIST) sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) signer = NostrSigner.keys(keys) if self.database is None: self.database = NostrDatabase.lmdb(self.db_name) + cli = ClientBuilder().signer(signer).database(self.database).opts(opts).build() for relay in self.dvm_config.RECONCILE_DB_RELAY_LIST: diff --git a/setup.py b/setup.py index f8eb736..095675c 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.8.20' +VERSION = '0.8.21' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information') diff --git a/tests/discovery.py b/tests/discovery.py index 8147d25..2839f04 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -621,7 +621,7 @@ def playground(): admin_config_db_scheduler= AdminConfig() options_animal = { "db_name": main_db, - "db_since": 48 * 60 * 60, # 48h since gmt, + "db_since": 6 * 60 * 60, # 48h since gmt, "personalized": False, "logger": False} image = ""