]> git.proxmox.com Git - pve-storage.git/commitdiff
api: FileRestore: make use of file-restores and guis timeout mechanism
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 10 Nov 2022 10:36:33 +0000 (11:36 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Nov 2022 10:03:08 +0000 (11:03 +0100)
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@proxmox.com>
PVE/API2/Storage/FileRestore.pm

index 4033136bad333eac7a9bc46520772334a6e0e23d..764ebfba751dc98f89d79edbd5fbdfd6921f5b8d 100644 (file)
@@ -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};