From fd9747db1a25babd17b5fe0e42fd70bbef898657 Mon Sep 17 00:00:00 2001 From: rashadg1030 Date: Thu, 8 Aug 2019 15:07:10 -0700 Subject: [PATCH] [#45] Add syncCache function Resolves #45 --- src/IW/Sync/Update.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/IW/Sync/Update.hs b/src/IW/Sync/Update.hs index 3c6c577..11e1b90 100644 --- a/src/IW/Sync/Update.hs +++ b/src/IW/Sync/Update.hs @@ -4,13 +4,13 @@ data and insert it into the database. -} module IW.Sync.Update - ( syncWithGithub + ( syncCache ) where import Control.Monad.IO.Unlift (MonadUnliftIO) import UnliftIO.Async (async, mapConcurrently_, wait) -import IW.App (WithError) +import IW.App (WithError, catchError) import IW.Core.Repo (Repo (..)) import IW.Db (WithDb, upsertRepos, updateRepoCategories, upsertIssues) import IW.Effects.Cabal (MonadCabal (..), getCabalCategories) @@ -18,6 +18,18 @@ import IW.Sync.Search (searchAllHaskellRepos, searchAllHaskellIssues) import IW.Time (getToday) +syncCache + :: forall env m. + ( MonadCabal m + , MonadUnliftIO m + , WithDb env m + , WithLog env m + , WithError m + ) + => Integer + -> m () +syncCache interval = forever $ syncWithGithub interval `catchError` undefined + -- | This function synchronizes the database with the latest GitHub data. syncWithGithub :: forall env m.