Skip to content

Commit

Permalink
[#45] Add syncCache function
Browse files Browse the repository at this point in the history
Resolves #45
  • Loading branch information
rashadg1030 committed Aug 17, 2019
1 parent 3afd8bd commit fd9747d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/IW/Sync/Update.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@ 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)
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.
Expand Down

0 comments on commit fd9747d

Please sign in to comment.