error handling on subscription check

This commit is contained in:
Believethehype
2024-05-06 15:20:35 +02:00
parent 22a2925595
commit 6d000a1066
2 changed files with 65 additions and 60 deletions

View File

@@ -187,6 +187,8 @@ class Subscription:
print(str(zapped_amount) + "/" + str(overall_amount)) print(str(zapped_amount) + "/" + str(overall_amount))
if zapped_amount < overall_amount * 0.8: # TODO how do we handle failed zaps for some addresses? we are ok with 80% for now if zapped_amount < overall_amount * 0.8: # TODO how do we handle failed zaps for some addresses? we are ok with 80% for now
#if zapped_amount < int(zaps[0][3]):
success = False success = False
else: else:
success = True success = True
@@ -404,6 +406,7 @@ class Subscription:
send_event(evt, client=self.client, dvm_config=dvm_config) send_event(evt, client=self.client, dvm_config=dvm_config)
def check_subscriptions(): def check_subscriptions():
try:
subscriptions = get_all_subscriptions_from_sql_table(dvm_config.DB) subscriptions = get_all_subscriptions_from_sql_table(dvm_config.DB)
for subscription in subscriptions: for subscription in subscriptions:
@@ -434,6 +437,8 @@ class Subscription:
print(str(Timestamp.now().as_secs()) + ": Checking " + str( print(str(Timestamp.now().as_secs()) + ": Checking " + str(
len(subscriptions)) + " Subscription entries..") len(subscriptions)) + " Subscription entries..")
except Exception as e:
print(e)
self.client.handle_notifications(NotificationHandler()) self.client.handle_notifications(NotificationHandler())

View File

@@ -7,35 +7,35 @@ Reusable backend functions can be defined in backends (e.g. API calls)
Current List of Tasks: Current List of Tasks:
| Module | Kind | Description | Backend | | Module | Kind | Description | Backend |
|--------------------------------------|------|------------------------------------------------------------|------------------| |----------------------------|------|------------------------------------------------------|------------------|
| TextExtractionPDF | 5000 | Extracts Text from a PDF file | local | | TextExtractionPDF | 5000 | Extracts Text from a PDF file | local |
| SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google Services | googleAPI | | SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google Services | googleAPI |
| SpeechToTextWhisperX | 5000 | Extracts Speech from Media files via local WhisperX | nserver | | SpeechToTextWhisperX | 5000 | Extracts Speech from Media files via local WhisperX | nserver |
| ImageInterrogator | 5000 | Extracts Prompts from Images | nserver | | ImageInterrogator | 5000 | Extracts Prompts from Images | nserver |
| TextSummarizationHuggingChat | 5001 | Summarizes given Input | huggingface | | TextSumHuggingChat | 5001 | Summarizes given Input | huggingface |
| **TextSummarizationUnleasedChat** | 5001 | Summarizes given Input | unleashed api | | **TextSumUnleashedChat** | 5001 | Summarizes given Input | unleashed api |
| TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI | | TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI |
| TranslationLibre | 5002 | Translates Inputs to another language | libreAPI | | TranslationLibre | 5002 | Translates Inputs to another language | libreAPI |
| TextGenerationLLMLite | 5050 | Chat with LLM backends like Ollama, ChatGPT etc | local/api/openai | | TextGenerationLLMLite | 5050 | Chat with LLM backends like Ollama, ChatGPT etc | local/api/openai |
| TextGenerationHuggingChat | 5050 | Chat with LLM backend on Huggingface | huggingface | | TextGenerationHuggingChat | 5050 | Chat with LLM backend on Huggingface | huggingface |
| TextGenerationLLMUnleashedChat | 5050 | Chat with unleashed.chat LLMs | unleashed api | | TextGenLLMUnleashedChat | 5050 | Chat with unleashed.chat LLMs | unleashed api |
| ImageGenerationSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | nserver | | ImageGenSDXL | 5100 | Generates an Image from Prompt with SD XL | nserver |
| ImageGenerationSDXLIMG2IMG | 5100 | Generates an Image from an Image with Stable Diffusion XL | nserver | | ImageGenSDXLIMG2IMG | 5100 | Generates an Image from an Image with SD XL | nserver |
| ImageGenerationReplicateSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | replicate | | ImageGenReplicateSDXL | 5100 | Generates an Image from Prompt with SDXL | replicate |
| ImageGenerationMLX | 5100 | Generates an Image with Stable Diffusion 2.1 on M1/2/3 Mac | mlx | | ImageGeneMLX | 5100 | Generates an Image with SD 2.1 on M-Mac | mlx |
| ImageGenerationDALLE | 5100 | Generates an Image with OpenAI's Dall-E | openAI | | ImageGenDALLE | 5100 | Generates an Image with OpenAI's Dall-E | openAI |
| ImageUpscale | 5100 | Upscales an Image | nserver | | ImageUpscale | 5100 | Upscales an Image | nserver |
| MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI | | MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI |
| VideoGenerationReplicateSVD | 5202 | Generates a Video from an Image | replicate | | VideoGenReplicateSVD | 5202 | Generates a Video from an Image | replicate |
| VideoGenerationSVD | 5202 | Generates a Video from an Image | nserver | | VideoGenerationSVD | 5202 | Generates a Video from an Image | nserver |
| TextToSpeech | 5250 | Generate Audio from a prompt | local | | TextToSpeech | 5250 | Generate Audio from a prompt | local |
| TrendingNotesNostrBand | 5300 | Show trending notes on nostr.band | nostr.band api | | TrendingNotesNostrBand | 5300 | Show trending notes on nostr.band | nostr.band api |
| **Discover Currently Popular Notes** | 5300 | Show trending notes in the last 2 hours | local/db | | **Discover Popular Notes** | 5300 | Show trending notes in the last 2 hours | local/db |
| **Discover CPN Followers** | 5300 | Show trending notes by people you follow | local/db | | **Discover CPN Followers** | 5300 | Show trending notes by people you follow | local/db |
| DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local | | DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local |
| **DiscoverNonFollows** | 5301 | Find Nostr users not following back | local | | **DiscoverNonFollows** | 5301 | Find Nostr users not following back | local |
| **Discover Bot Farms** | 5301 | Find Bots, so you can mute them | local | | **Discover Bot Farms** | 5301 | Find Bots, so you can mute them | local |
| **Discover Censor WOT** | 5301 | Find users that have been reported by your follows/WOT | local | | **Discover Censor WOT** | 5301 | Find users that have been reported by follows/WOT | local |
| AdvancedSearch | 5302 | Search Content on relays (nostr.band) | local/nostr.band | | AdvancedSearch | 5302 | Search Content on relays (nostr.band) | local/nostr.band |
| AdvancedSearchWine | 5302 | Search Content on nostr.wine | api/nostr.wine | | AdvancedSearchWine | 5302 | Search Content on nostr.wine | api/nostr.wine |
| **Search Users** | 5303 | Search Users based on search terms | local/db | | **Search Users** | 5303 | Search Users based on search terms | local/db |