Detect missing S3 objects #6
This commit is contained in:
parent
673dad882d
commit
b176c38dbe
1 changed files with 3 additions and 2 deletions
|
@ -137,7 +137,7 @@ cachedS3Store cache creds bucket prefix manager =
|
||||||
case msrc of
|
case msrc of
|
||||||
Just src -> return $ Just src
|
Just src -> return $ Just src
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
liftIO $ runResourceT $ do
|
join $ liftIO $ handle (\S3Error{} -> return $ return Nothing) $ runResourceT $ do
|
||||||
res <- Aws.aws
|
res <- Aws.aws
|
||||||
(Aws.Configuration Aws.Timestamp creds
|
(Aws.Configuration Aws.Timestamp creds
|
||||||
$ Aws.defaultLog Aws.Error)
|
$ Aws.defaultLog Aws.Error)
|
||||||
|
@ -146,6 +146,7 @@ cachedS3Store cache creds bucket prefix manager =
|
||||||
(Aws.getObject bucket (toS3Path key))
|
(Aws.getObject bucket (toS3Path key))
|
||||||
gor <- Aws.readResponseIO res
|
gor <- Aws.readResponseIO res
|
||||||
let fp = toFP cache key
|
let fp = toFP cache key
|
||||||
|
liftIO $ F.createTree $ directory fp
|
||||||
bracketOnError
|
bracketOnError
|
||||||
(liftIO $ IO.openBinaryTempFile
|
(liftIO $ IO.openBinaryTempFile
|
||||||
(fpToString $ directory fp)
|
(fpToString $ directory fp)
|
||||||
|
@ -158,7 +159,7 @@ cachedS3Store cache creds bucket prefix manager =
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
hClose h
|
hClose h
|
||||||
F.rename (fpFromString fpTmp) fp
|
F.rename (fpFromString fpTmp) fp
|
||||||
storeRead' (fileStore cache) key -- FIXME optimize?
|
return $ storeRead' (fileStore cache) key -- FIXME optimize?
|
||||||
else storeRead' (fileStore cache) key
|
else storeRead' (fileStore cache) key
|
||||||
, storeExists' = \key ->
|
, storeExists' = \key ->
|
||||||
if shouldBackup key
|
if shouldBackup key
|
||||||
|
|
Loading…
Reference in a new issue