aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorJoris2022-11-27 15:38:39 +0100
committerJoris2022-11-27 15:38:39 +0100
commitd3fb69cf129fe70c932a5d82fdd1bcc613544b5b (patch)
tree6a098c7900f96791489b8548979fb71ccea03e59 /src/util
parent765ba94cdd65184bd4b443c3a946d0d96dc805d6 (diff)
Speed up deck synchronization
Apply changes for what has been inserted, updated, removed. Also use transactions to speed up multi-writing.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/time.rs18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/util/time.rs b/src/util/time.rs
index 679d1b4..e4bf75c 100644
--- a/src/util/time.rs
+++ b/src/util/time.rs
@@ -1,5 +1,4 @@
use anyhow::Result;
-use std::thread;
use std::time::SystemTime;
pub fn seconds_since_unix_epoch() -> Result<u64> {
@@ -36,20 +35,3 @@ fn plural(n: u64, str: &str) -> String {
format!("{n} {str}s")
}
}
-
-/// Call the function, then sleep if necessary.
-///
-/// Calling this will at least take the duration asked for in parameters.
-pub fn wait_at_least<F>(f: F, d: std::time::Duration) -> Result<()>
-where
- F: Fn() -> Result<()>,
-{
- let t1 = SystemTime::now();
- f()?;
- let t2 = SystemTime::now();
- let elapsed = t2.duration_since(t1)?;
- if elapsed < d {
- thread::sleep(d - elapsed);
- }
- Ok(())
-}