"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
docker serve: restore volumes concurrently so one slow remote doesn't block others
Nick Craig-Wood8bfe94770a21
diff --git a/cmd/serve/docker/driver.go b/cmd/serve/docker/driver.goindex ad0a420e8..8a4d3b9bb 100644--- a/cmd/serve/docker/driver.go+++ b/cmd/serve/docker/driver.go@@ -361,17 +361,33 @@ func (drv *Driver) restoreState(ctx context.Context) error {return nil}- for _, vol := range state {- // Use a timeout so that a slow or unreachable remote does- // not block the plugin from starting up.- volCtx, cancel := context.WithTimeout(ctx, volTimeout)- err := vol.restoreState(volCtx, drv)- cancel()- if err != nil {- fs.Logf(nil, "Failed to restore volume %q: %v", vol.Name, err)+ // Restore volumes concurrently so one slow remote doesn't+ // block restoring the others.+ type result struct {+ vol *Volume+ err error+ }+ results := make([]result, len(state))+ var wg sync.WaitGroup+ for i, vol := range state {+ wg.Add(1)+ go func(i int, vol *Volume) {+ defer wg.Done()+ // Use a timeout so that a slow or unreachable remote does+ // not block the plugin from starting up.+ volCtx, cancel := context.WithTimeout(ctx, volTimeout)+ defer cancel()+ results[i] = result{vol: vol, err: vol.restoreState(volCtx, drv)}+ }(i, vol)+ }+ wg.Wait()++ for _, r := range results {+ if r.err != nil {+ fs.Logf(nil, "Failed to restore volume %q: %v", r.vol.Name, r.err)continue}- drv.volumes[vol.Name] = vol+ drv.volumes[r.vol.Name] = r.vol}return nil}