error handling for db reconciliation for content-discovery

This commit is contained in:
Believethehype 2024-08-26 07:39:18 +02:00
parent e8bccc939a
commit 608c5fa651
10 changed files with 275 additions and 255 deletions

View File

@ -171,6 +171,7 @@ class DicoverContentLatestLongForm(DVMTaskInterface):
return 1
async def sync_db(self):
try:
relaylimits = RelayLimits.disable()
opts = (Options().wait_for_send(False).send_timeout(
timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT))).relay_limits(relaylimits)
@ -202,7 +203,8 @@ class DicoverContentLatestLongForm(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -171,6 +171,7 @@ class DicoverContentLatestWiki(DVMTaskInterface):
return 1
async def sync_db(self):
try:
relaylimits = RelayLimits.disable()
opts = (Options().wait_for_send(False).send_timeout(
timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT))).relay_limits(relaylimits)
@ -202,7 +203,8 @@ class DicoverContentLatestWiki(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -170,6 +170,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
return 0
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -200,7 +201,8 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -225,6 +225,7 @@ class DicoverContentCurrentlyPopularZaps(DVMTaskInterface):
return 1
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -255,7 +256,8 @@ class DicoverContentCurrentlyPopularZaps(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -194,6 +194,7 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface):
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -225,6 +226,8 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print("[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(
self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,

View File

@ -245,6 +245,7 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface):
return 0
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -274,7 +275,8 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -219,6 +219,7 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface):
return 0
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -268,6 +269,8 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface):
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(
self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,

View File

@ -221,6 +221,7 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface):
return 1
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -251,7 +252,8 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface):
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -188,6 +188,7 @@ class DicoverContentCurrentlyPopularbyTopic(DVMTaskInterface):
return 1
async def sync_db(self):
try:
opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT)))
sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY)
keys = Keys.parse(sk.to_hex())
@ -216,9 +217,10 @@ class DicoverContentCurrentlyPopularbyTopic(DVMTaskInterface):
Timestamp.now().as_secs() - self.db_since))) # Clear old events so db doesn't get too full.
await cli.shutdown()
if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
print(
"[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
print("[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str(self.db_since) + " seconds..")
except Exception as e:
print(e)
# We build an example here that we can call by either calling this file directly from the main directory,
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the

View File

@ -1,6 +1,6 @@
from setuptools import setup, find_packages
VERSION = '0.8.6'
VERSION = '0.8.7'
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')