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 199CA712A4 for ; Mon, 28 Jun 2021 13:53:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0A3872AA55 for ; Mon, 28 Jun 2021 13:52:39 +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 DC2002AA48 for ; Mon, 28 Jun 2021 13:52:37 +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 AD31E4446C for ; Mon, 28 Jun 2021 13:52:37 +0200 (CEST) Date: Mon, 28 Jun 2021 13:52:36 +0200 From: Wolfgang Bumiller To: Stefan Reiter Cc: pbs-devel@lists.proxmox.com Message-ID: <20210628115236.wb5sv7edbe35se23@olga.proxmox.com> References: <20210617090232.3615250-1-s.reiter@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210617090232.3615250-1-s.reiter@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.699 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] applied: [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: Mon, 28 Jun 2021 11:53:09 -0000 applied On Thu, Jun 17, 2021 at 11:02:32AM +0200, Stefan Reiter wrote: > 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