From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 8C91A72EF0 for ; Thu, 17 Jun 2021 11:03:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7BAE119821 for ; Thu, 17 Jun 2021 11:02:42 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 087B619817 for ; Thu, 17 Jun 2021 11:02:42 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C7D9A441B7 for ; Thu, 17 Jun 2021 11:02:41 +0200 (CEST) From: Stefan Reiter To: pbs-devel@lists.proxmox.com Date: Thu, 17 Jun 2021 11:02:32 +0200 Message-Id: <20210617090232.3615250-1-s.reiter@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.769 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup] async_lru_cache: fix handling of errors in fetch X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 09:03:12 -0000 The future needs to be removed from the pending map in any case, even if it returned an error, else all upcoming calls to access this key will always return the same error. Signed-off-by: Stefan Reiter --- I don't think this can happen at the moment, as we only use this in parts of the code were one returned error already causes an abort, but should still be fixed. src/tools/async_lru_cache.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tools/async_lru_cache.rs b/src/tools/async_lru_cache.rs index cc385ec9..62e74fcd 100644 --- a/src/tools/async_lru_cache.rs +++ b/src/tools/async_lru_cache.rs @@ -65,15 +65,16 @@ impl AsyncL }; let result = result_fut.await; - match result { - Ok(Some(ref value)) if owner => { - // this call was the one initiating the request, put into LRU and remove from map - let mut maps = self.maps.lock().unwrap(); + + if owner { + // this call was the one initiating the request, put into LRU and remove from map + let mut maps = self.maps.lock().unwrap(); + if let Ok(Some(ref value)) = result { maps.0.insert(key, value.clone()); - maps.1.remove(&key); } - _ => {} + maps.1.remove(&key); } + result } } -- 2.30.2