[pbs-devel] [PATCH storage v4 2/3] api: FileRestore: make use of file-restores and guis timeout mechanism

Dominik Csapak d.csapak at proxmox.com
Thu Nov 10 11:36:33 CET 2022


file-restore has a 'timeout' parameter and if that is exceeded, returns
an error with the http code 503 Service Unavailable

When the web ui encounters such an error, it retries the listing a few
times before giving up.

To make use of these, add the 'timeout' parameter to the new
'extraParams' of 'file_restore_list'.

25 seconds are chosen because it's under pveproxy 30s limit, with a bit
of overhead to spare for the rest of the api call, like json decoding,
forking, access control checks, etc.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v4
depends on pve-common 1/2

 PVE/API2/Storage/FileRestore.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Storage/FileRestore.pm b/PVE/API2/Storage/FileRestore.pm
index 4033136..764ebfb 100644
--- a/PVE/API2/Storage/FileRestore.pm
+++ b/PVE/API2/Storage/FileRestore.pm
@@ -119,7 +119,7 @@ __PACKAGE__->register_method ({
 	my (undef, $snap) = PVE::Storage::parse_volname($cfg, $volid);
 
 	my $client = PVE::PBSClient->new($scfg, $storeid);
-	my $ret = $client->file_restore_list($snap, $path, $base64);
+	my $ret = $client->file_restore_list($snap, $path, $base64, { timeout => 25 });
 
 	if (ref($ret) eq "HASH") {
 	    my $msg = $ret->{message};
-- 
2.30.2






More information about the pbs-devel mailing list