summaryrefslogtreecommitdiff
path: root/Remote/S3.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-11-04 15:39:48 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-11-04 15:39:48 -0400
commit4134c7f356afbd52bdbc660cba6ffd584cae7ee5 (patch)
treec04170ca15eb3c89070c714df63795fedab1b1d9 /Remote/S3.hs
parentff7715768f839e9eba0e7e7b135dc6ebea6602a4 (diff)
fix a couple type errors and the progress bar
Diffstat (limited to 'Remote/S3.hs')
-rw-r--r--Remote/S3.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index a1f5bf75d..e0ff93bb3 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -173,13 +173,13 @@ store r h = fileStorer $ \k f p -> do
let info = hinfo h
let object = bucketObject info k
- let req = (S3.postInitiateMultipartUpload (bucket info) object)
+ let startreq = (S3.postInitiateMultipartUpload (bucket info) object)
{ S3.imuStorageClass = Just (storageClass info)
, S3.imuMetadata = metaHeaders info
, S3.imuAutoMakeBucket = isIA info
, S3.imuExpires = Nothing -- TODO set some reasonable expiry
}
- uploadid <- S3.imurUploadId <$> sendS3Handle h req
+ uploadid <- S3.imurUploadId <$> sendS3Handle h startreq
-- The actual part size will be a even multiple of the
-- 32k chunk size that hGetUntilMetered uses.
@@ -198,8 +198,9 @@ store r h = fileStorer $ \k f p -> do
let sz = if fsz - pos < partsz'
then fsz - pos
else partsz'
- let numchunks = ceiling (fromIntegral sz / defaultChunkSize)
- let popper = handlePopper numchunks defaultChunkSize p fh
+ let p' = offsetMeterUpdate p (toBytesProcessed pos)
+ let numchunks = ceiling (fromIntegral sz / fromIntegral defaultChunkSize :: Double)
+ let popper = handlePopper numchunks defaultChunkSize p' fh
let req = S3.uploadPart (bucket info) object partnum uploadid $
RequestBodyStream (fromIntegral sz) popper
S3.UploadPartResponse _ etag <- sendS3Handle h req