fix upload

This commit is contained in:
2026-02-13 21:27:11 +01:00
parent 7a9bb31e67
commit dbfd99f410
2 changed files with 22 additions and 4 deletions

View File

@@ -5,7 +5,9 @@ import (
"fmt"
"io"
"log"
"net/http"
"os/exec"
"time"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
@@ -29,9 +31,23 @@ type S3Backend struct {
// NewS3Backend creates a new S3 storage backend
func NewS3Backend(endpoint, accessKey, secretKey, bucketName string, useSSL bool) (*S3Backend, error) {
// Create custom HTTP transport with extended timeouts for large file uploads
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
// Extended timeouts for streaming large ZFS snapshots
ResponseHeaderTimeout: 5 * time.Minute,
ExpectContinueTimeout: 30 * time.Second,
IdleConnTimeout: 90 * time.Second,
// Connection pooling
MaxIdleConns: 10,
MaxIdleConnsPerHost: 10,
DisableCompression: false,
}
client, err := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
Secure: useSSL,
Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
Secure: useSSL,
Transport: transport,
})
if err != nil {
return nil, fmt.Errorf("failed to create S3 client: %v", err)