Automattic / hostmgr

A tool for managing macOS VM hosts
Mozilla Public License 2.0
8 stars 3 forks source link

Set S3 download timeout based on the file size #38

Closed crazytonyli closed 1 year ago

crazytonyli commented 1 year ago

Since the VM image size varies, there are 25 GB ones, and there are close to 40 GB ones, using one single timeout value may cause failure when downloading larger VM images, unless we use an arbitrary large timeout value. This PR sets the timeout based on the file size, calculated with an expected downloading speed of 10 MB/s.

I found out there is a .s3UseTransferAcceleratedEndpoint option in the soto library, so I made a small change while I'm changing this code.

(Hopefully this is the last PR to tweak the timeout value 😂)