summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-24 21:32:37 -0600
committermsglm <msglm@techchud.xyz>2023-01-24 21:32:37 -0600
commit64034653364389a24d0b57c6d264bf4bd83c7bfe (patch)
tree918a7dbf28e934600192363849074f9c40208324
parent2fbd0cbf5e6c966b5260d07e8422cc4045ccdf43 (diff)
downloadindeedwatcher-64034653364389a24d0b57c6d264bf4bd83c7bfe.tar.gz
indeedwatcher-64034653364389a24d0b57c6d264bf4bd83c7bfe.tar.bz2
indeedwatcher-64034653364389a24d0b57c6d264bf4bd83c7bfe.zip
program saves to cache more often
-rw-r--r--src/indeedwatcher.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/indeedwatcher.nim b/src/indeedwatcher.nim
index 7419321..645d59e 100644
--- a/src/indeedwatcher.nim
+++ b/src/indeedwatcher.nim
@@ -40,7 +40,7 @@ let outdir = config["outdir"].getStr()
##Cache section of config
let chromedriverloc = config["chromedriver"].getStr()
let cachefileloc = getCacheDir() & "/indeedwatcher/listings.cache"
-var cache = splitLines(readFile(cachefileloc))
+var cache: seq[string]
##Filtering section of config
let titleblacklist = config["blacklist"]["title"].getElems().mapIt(it.getStr())
@@ -68,6 +68,8 @@ proc terminate() {.noconv.} =
setControlCHook(terminate)
for feed in feeds:
+
+ cache = splitLines(readFile(cachefileloc))
#Getting the listing URLs from the feeds
var rssFeedReply: RSS
@@ -140,8 +142,8 @@ for feed in feeds:
echo "Trigger was hit, discarding " & URL
else:
echo URL & " was in cache, discarding"
+ writeFile(cachefileloc, cache.join("\n"))
session.close()
terminate(chromedriver)
-writeFile(cachefileloc, cache.join("\n"))