on develop help sign in
removed refreshStore function
3d37a50Rueshyna
gogol/src/Network/Google/Auth.hs−22
@@ -35,7 +35,6 @@ module Network.Google.Auth
35 -- ** Thread-safe Storage
35 -- ** Thread-safe Storage
36 , Store
36 , Store
37 , initStore
37 , initStore
38− , refreshStore
39 , retrieveAuthFromStore
38 , retrieveAuthFromStore
40
39
41 , Auth (..)
40 , Auth (..)
@@ -128,27 +127,6 @@ initStore :: (MonadIO m, MonadCatch m, AllowScopes s)
128 -> m (Store s)
127 -> m (Store s)
129initStore c l m = exchange c l m >>= fmap Store . liftIO . newMVar
128initStore c l m = exchange c l m >>= fmap Store . liftIO . newMVar
130
129
131−-- | Refresh an 'OAuthToken' if it was expired.
132−-- Otherwise, keep original one.
133−refreshStore :: (MonadIO m, MonadCatch m, AllowScopes s)
134− => Store s
135− -> Logger
136− -> Manager
137− -> m (Store s)
138−refreshStore ss@(Store s) l m = do
139− x <- retrieveAuthFromStore ss
140− mx <- validate x
141− if mx
142− then pure ss
143− else liftIO . modifyMVar s $ \y -> do
144− my <- validate y
145− if my
146− then pure (y, ss)
147− else do
148− z <- refresh y l m
149− tt <- fmap Store . liftIO . newMVar $ z
150− pure (z, tt)
151−
152-- | Retrieve auth from storage
130-- | Retrieve auth from storage
153retrieveAuthFromStore :: (MonadIO m, MonadCatch m, AllowScopes s)
131retrieveAuthFromStore :: (MonadIO m, MonadCatch m, AllowScopes s)
154 => Store s
132 => Store s