Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eliminate the block call in ticker #36

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions components/backup-stream/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use resolved_ts::Resolver;

use tikv_util::time::Instant;

use crossbeam_channel::tick;
use tokio::io::Result as TokioResult;
use tokio::runtime::Runtime;
use tokio_stream::StreamExt;
Expand Down Expand Up @@ -143,10 +142,9 @@ where
PDC: PdClient + 'static,
{
async fn starts_flush_ticks(router: Router) {
let ticker = tick(Duration::from_secs(FLUSH_STORAGE_INTERVAL / 5));
loop {
// wait 1min to trigger tick
let _ = ticker.recv().unwrap();
tokio::time::sleep(Duration::from_secs(FLUSH_STORAGE_INTERVAL / 5)).await;
debug!("backup stream trigger flush tick");
router.tick().await;
}
Expand Down