fix nostrband search by deactivating ping

This commit is contained in:
Believethehype 2024-03-19 14:28:08 +01:00
parent f53100a5e3
commit 168c04d86a
2 changed files with 7 additions and 2 deletions

View File

@ -401,6 +401,7 @@ class DVM:
post_processed = dvm.post_process(data, original_event)
send_nostr_reply_event(post_processed, original_event.as_json())
except Exception as e:
print(e)
# Zapping back by error in post-processing is a risk for the DVM because work has been done,
# but maybe something with parsing/uploading failed. Try to avoid errors here as good as possible
send_job_status_reaction(original_event, "error",
@ -596,9 +597,11 @@ class DVM:
post_processed = dvm.post_process(result, job_event)
send_nostr_reply_event(post_processed, job_event.as_json())
except Exception as e:
print(e)
send_job_status_reaction(job_event, "error", content=str(e),
dvm_config=self.dvm_config)
except Exception as e:
print(e)
# we could send the exception here to the user, but maybe that's not a good idea after all.
send_job_status_reaction(job_event, "error", content=result,
dvm_config=self.dvm_config)

View File

@ -1,7 +1,7 @@
import json
import os
from datetime import timedelta
from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind
from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayOptions
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv
from nostr_dvm.utils.admin_utils import AdminConfig
@ -95,7 +95,9 @@ class AdvancedSearch(DVMTaskInterface):
signer = NostrSigner.keys(keys)
cli = Client.with_opts(signer, opts)
cli.add_relay(options["relay"])
ropts = RelayOptions().ping(False)
cli.add_relay_with_opts(options["relay"], ropts)
cli.connect()
#earch_since_seconds = int(options["since"]) * 24 * 60 * 60