Skip to content

Commit

Permalink
fix: resolve review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
v0y4g3r committed Jan 9, 2024
1 parent ad8806b commit 3ed9890
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/log-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ common-macro.workspace = true
common-meta.workspace = true
common-runtime.workspace = true
common-telemetry.workspace = true
common-time.workspace = true
dashmap.workspace = true
futures-util.workspace = true
futures.workspace = true
Expand Down
14 changes: 5 additions & 9 deletions src/log-store/src/raft_engine/log_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::collections::HashMap;
use std::fmt::{Debug, Formatter};
use std::sync::atomic::{AtomicI64, Ordering};
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};

use async_stream::stream;
use common_config::wal::{RaftEngineConfig, WalOptions};
Expand Down Expand Up @@ -217,14 +216,11 @@ impl LogStore for RaftEngineLogStore {
}

let mut sync = self.config.sync_write;
if let Some(sync_period) = self.config.sync_period.as_ref()
&& let Ok(now) = SystemTime::now().duration_since(UNIX_EPOCH)
{
let now_millis = now.as_millis() as i64;
if now_millis - self.last_sync_time.load(Ordering::Relaxed)
>= sync_period.as_millis() as i64
{
self.last_sync_time.store(now_millis, Ordering::Relaxed);

if let Some(sync_period) = self.config.sync_period.as_ref() {
let now = common_time::util::current_time_millis();
if now - self.last_sync_time.load(Ordering::Relaxed) >= sync_period.as_millis() as i64 {
self.last_sync_time.store(now, Ordering::Relaxed);
sync = true;
}
}
Expand Down

0 comments on commit 3ed9890

Please sign in to comment.