From d3f53661d5366306a1cf9ef66fbf02a754cc5c3d Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Wed, 24 Jan 2024 20:40:44 +0100 Subject: Read limit as current, not as limit XD --- server/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/src/main.rs b/server/src/main.rs index d96ac17..db37d14 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1043,21 +1043,21 @@ impl DownloadLimiter { return Ok(false); } self.current += n; - self.write_new_limit().await?; + self.write_new_count().await?; Ok(true) } async fn reset(&mut self) { self.current = 0; - if let Err(e) = self.write_new_limit().await { + if let Err(e) = self.write_new_count().await { println!("Failed to reset download counter: {e}"); } } - async fn write_new_limit(&self) -> tokio::io::Result<()> { + async fn write_new_count(&self) -> tokio::io::Result<()> { let cwd = tokio::fs::File::open(std::env::current_dir()?).await?; let mut file = tokio::fs::File::create(".gitolfs3-dlimit.tmp").await?; - file.write_all(self.limit.to_string().as_bytes()).await?; + file.write_all(self.current.to_string().as_bytes()).await?; file.sync_all().await?; tokio::fs::rename(".gitolfs3-dlimit.tmp", ".gitolfs3-dlimit").await?; cwd.sync_all().await -- cgit v1.2.3