Skip to content

Commit

Permalink
eliminate the block call in ticker (#36)
Browse files Browse the repository at this point in the history
* eliminate the block call in ticker

* revert some change

Signed-off-by: Yu Juncen <yujuncen@pingcap.com>
  • Loading branch information
YuJuncen authored Mar 30, 2022
1 parent 0f084d3 commit cd8c7ae
Showing 1 changed file with 1 addition and 3 deletions.
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

0 comments on commit cd8c7ae

Please sign in to comment.