fix: increase PBS storage content timeout to 60s

PBS storage content queries with encrypted backups can take 10-20+ seconds
to enumerate. The previous 30s timeout was causing intermittent failures
when polling backup data from PBS storage configured in PVE.

This increases the timeout to 60s to accommodate slow PBS backends while
still preventing indefinite hangs on unavailable NFS/network storage.
This commit is contained in:
rcourtman 2025-12-26 00:21:17 +00:00
parent 11c79173b4
commit 3fd20340d1

View file

@ -1090,14 +1090,14 @@ func (c *Client) GetContainerInterfaces(ctx context.Context, node string, vmid i
// GetStorageContent returns the content of a specific storage
func (c *Client) GetStorageContent(ctx context.Context, node, storage string) ([]StorageContent, error) {
// Storage content queries can take longer on large storages
// Create a new context with shorter timeout for storage API calls
// Storage endpoints can hang when NFS/network storage is unavailable
// Using 30s timeout as a balance between responsiveness and reliability
// Storage content queries can take longer on large storages, especially PBS
// with encrypted backups which can take 10-20+ seconds to enumerate.
// Using 60s timeout to accommodate slow PBS storage backends while still
// preventing indefinite hangs on unavailable NFS/network storage.
storageCtx := ctx
if deadline, ok := ctx.Deadline(); !ok || time.Until(deadline) > 30*time.Second {
if deadline, ok := ctx.Deadline(); !ok || time.Until(deadline) > 60*time.Second {
var cancel context.CancelFunc
storageCtx, cancel = context.WithTimeout(ctx, 30*time.Second)
storageCtx, cancel = context.WithTimeout(ctx, 60*time.Second)
defer cancel()
}