summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2025-08-17 19:54:24 -0500
committermsglm <msglm@techchud.xyz>2025-08-17 19:54:24 -0500
commitb8dc46fff4c5cabceab9debb8d02d83b45e4f020 (patch)
treed7826ab2fa291057c54dcdc0d9e1ccc746e06c04
parent7c2f9be35455fd8d7b8c2458d5a2009ef630c279 (diff)
downloadindeed-watcher-b8dc46fff4c5cabceab9debb8d02d83b45e4f020.tar.gz
indeed-watcher-b8dc46fff4c5cabceab9debb8d02d83b45e4f020.tar.bz2
indeed-watcher-b8dc46fff4c5cabceab9debb8d02d83b45e4f020.zip
spruced up the retry feature for slower connections and better stability
-rw-r--r--indeedwatcher.nimble2
-rw-r--r--src/indeedwatcher.nim31
2 files changed, 23 insertions, 10 deletions
diff --git a/indeedwatcher.nimble b/indeedwatcher.nimble
index 3357061..3845030 100644
--- a/indeedwatcher.nimble
+++ b/indeedwatcher.nimble
@@ -1,6 +1,6 @@
# Package
-version = "1.0.1"
+version = "1.0.2"
author = "msglm"
description = "Watches indeed for job updates."
license = "AGPL-3.0-only"
diff --git a/src/indeedwatcher.nim b/src/indeedwatcher.nim
index 69c0071..7419321 100644
--- a/src/indeedwatcher.nim
+++ b/src/indeedwatcher.nim
@@ -71,13 +71,17 @@ for feed in feeds:
#Getting the listing URLs from the feeds
var rssFeedReply: RSS
- #TODO implement a retry-on-fail system
- try:
- echo "now reading " & feed
- rssFeedReply = getRSS(feed)
- except:
- raise
-
+ for attempt in countup(0,3):
+ try:
+ echo "now reading " & feed
+ rssFeedReply = getRSS(feed)
+ except:
+ if attempt < 3:
+ echo "Recieved an error: trying again..."
+ continue
+ else:
+ raise
+ break
for entry in rssFeedReply.items:
#Sleep so indeed.com doesn't freak out
@@ -90,8 +94,17 @@ for feed in feeds:
var URL = entry.link
let URLID = entry.link.split('&')[3]
if not any(cache, proc (input: string): bool = input.contains(URLID)):
- echo "Telling chromium to navigate to " & URL
- session.navigate(URL)
+ for attempt in countup(0,3):
+ try:
+ echo "Telling chromium to navigate to " & URL
+ session.navigate(URL)
+ except:
+ if attempt < 3:
+ echo "Recieved an error: trying again..."
+ continue
+ else:
+ raise
+ break
counter = counter + 1
#HTML Parser