aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/main.rs8
1 files changed, 4 insertions, 4 deletions
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 {
1043 return Ok(false); 1043 return Ok(false);
1044 } 1044 }
1045 self.current += n; 1045 self.current += n;
1046 self.write_new_limit().await?; 1046 self.write_new_count().await?;
1047 Ok(true) 1047 Ok(true)
1048 } 1048 }
1049 1049
1050 async fn reset(&mut self) { 1050 async fn reset(&mut self) {
1051 self.current = 0; 1051 self.current = 0;
1052 if let Err(e) = self.write_new_limit().await { 1052 if let Err(e) = self.write_new_count().await {
1053 println!("Failed to reset download counter: {e}"); 1053 println!("Failed to reset download counter: {e}");
1054 } 1054 }
1055 } 1055 }
1056 1056
1057 async fn write_new_limit(&self) -> tokio::io::Result<()> { 1057 async fn write_new_count(&self) -> tokio::io::Result<()> {
1058 let cwd = tokio::fs::File::open(std::env::current_dir()?).await?; 1058 let cwd = tokio::fs::File::open(std::env::current_dir()?).await?;
1059 let mut file = tokio::fs::File::create(".gitolfs3-dlimit.tmp").await?; 1059 let mut file = tokio::fs::File::create(".gitolfs3-dlimit.tmp").await?;
1060 file.write_all(self.limit.to_string().as_bytes()).await?; 1060 file.write_all(self.current.to_string().as_bytes()).await?;
1061 file.sync_all().await?; 1061 file.sync_all().await?;
1062 tokio::fs::rename(".gitolfs3-dlimit.tmp", ".gitolfs3-dlimit").await?; 1062 tokio::fs::rename(".gitolfs3-dlimit.tmp", ".gitolfs3-dlimit").await?;
1063 cwd.sync_all().await 1063 cwd.sync_all().await