diff options
Diffstat (limited to 'src/AdListener.hs')
-rw-r--r-- | src/AdListener.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/AdListener.hs b/src/AdListener.hs index 1de56dc..c08efc5 100644 --- a/src/AdListener.hs +++ b/src/AdListener.hs @@ -34,11 +34,12 @@ listenToNewAds config = do eitherResumes <- fetchResumes (C.url config) case eitherResumes of Left error -> - listenError config [] error + showErrorAndListenBack config [] error Right resumes -> let newURLs = map url resumes in do putStrLn "Listening for new ads…" + waitOneMinute listenToNewAdsWithViewedURLs config newURLs listenToNewAdsWithViewedURLs :: Config -> [URL] -> IO () @@ -46,7 +47,7 @@ listenToNewAdsWithViewedURLs config viewedURLs = do eitherResumes <- fetchResumes (C.url config) case eitherResumes of Left error -> - listenError config viewedURLs error + showErrorAndListenBack config viewedURLs error Right resumes -> listenToNewAdsWithResumes config viewedURLs resumes @@ -57,7 +58,7 @@ listenToNewAdsWithResumes config viewedURLs resumes = eitherNewAds <- fetchAds newResumes case eitherNewAds of Left error -> - listenError config viewedURLs error + showErrorAndListenBack config viewedURLs error Right newAds -> do time <- getCurrentFormattedTime @@ -90,8 +91,8 @@ trySendMail config ads = , error ] -listenError :: Config -> [URL] -> Text -> IO () -listenError config viewedURLs error = do +showErrorAndListenBack :: Config -> [URL] -> Text -> IO () +showErrorAndListenBack config viewedURLs error = do T.putStrLn error waitOneMinute listenToNewAdsWithViewedURLs config viewedURLs |