mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 02:16:30 +00:00
Use MissedTickBehavior::Delay for updating crates.io-index (#161)
This commit is contained in:
parent
cf7513873b
commit
bacc736364
1 changed files with 2 additions and 1 deletions
|
@ -8,7 +8,7 @@ use crates_index::Crate;
|
||||||
use crates_index::Index;
|
use crates_index::Index;
|
||||||
use slog::{error, Logger};
|
use slog::{error, Logger};
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
use tokio::time;
|
use tokio::time::{self, MissedTickBehavior};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ManagedIndex {
|
pub struct ManagedIndex {
|
||||||
|
@ -31,6 +31,7 @@ impl ManagedIndex {
|
||||||
|
|
||||||
pub async fn refresh_at_interval(&self, update_interval: Duration) {
|
pub async fn refresh_at_interval(&self, update_interval: Duration) {
|
||||||
let mut update_interval = time::interval(update_interval);
|
let mut update_interval = time::interval(update_interval);
|
||||||
|
update_interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if let Err(e) = self.refresh().await {
|
if let Err(e) = self.refresh().await {
|
||||||
|
|
Loading…
Reference in a new issue