Skip to content

Commit

Permalink
chore: Optimize project dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
BinChengZhao committed May 20, 2024
1 parent 8f9a156 commit 560c92f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "delay_timer"
version = "0.11.5"
version = "0.11.6"
authors = ["binchengZhao <binchengZhao@outlook.com>"]
edition = "2018"
repository = "https://github.com/BinChengZhao/delay-timer"
Expand Down Expand Up @@ -30,14 +30,14 @@ status-report = []
cron_clock = "0.8.0"
anyhow = "^1.0.31"
rs-snowflake = "0.6.0"
dashmap = "^4.0.2"
lru = "^0.12.3"
dashmap = "=5.5.3"
lru = "0.12.3"
once_cell = "1.9.0"
futures = "^0.3.13"
smol = "^1.2.5"
concat-idents = "1.1.3"
async-trait = "^0.1.48"
event-listener = "^2.5.1"
event-listener = "=5.3.0"
log = "0.4.14"
tracing = "0.1.29"
thiserror = "^1.0.24"
Expand Down
4 changes: 2 additions & 2 deletions src/timer/runtime_trace/task_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Duration;

use event_listener::Event;
use event_listener::{Event, Listener};
use future_lite::block_on;
use smol::channel::{unbounded, Receiver, Sender};

Expand Down Expand Up @@ -165,7 +165,7 @@ impl TaskInstance {
.event
.listen()
.wait_timeout(timeout)
.then(|| self.get_state())
.map(|_| self.get_state())
.ok_or(TaskInstanceError::DisCancelTimeOut)
}

Expand Down
10 changes: 8 additions & 2 deletions src/timer/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@
use super::runtime_trace::task_handle::DelayTaskHandler;
use crate::prelude::*;

use std::num::NonZeroUsize;
use std::cell::RefCell;
use std::fmt;
use std::fmt::Pointer;
use std::num::NonZeroUsize;
use std::str::FromStr;
use std::sync::atomic::Ordering;

use cron_clock::{Schedule, ScheduleIteratorOwned, Utc};
use lru::LruCache;

// Parsing cache for cron expressions, stored with thread-local storage.
thread_local!(static CRON_EXPRESSION_CACHE: RefCell<LruCache<ScheduleIteratorTimeZoneQuery, DelayTimerScheduleIteratorOwned>> = RefCell::new(LruCache::new(NonZeroUsize::new(256).unwrap())));
thread_local!(
static CRON_EXPRESSION_CACHE: RefCell<
LruCache<ScheduleIteratorTimeZoneQuery, DelayTimerScheduleIteratorOwned>,
> = RefCell::new(LruCache::new(
NonZeroUsize::new(256).expect("256 is not zero."),
));
);

// TaskMark is used to maintain the status of running tasks.
#[derive(Default, Debug)]
Expand Down

0 comments on commit 560c92f

Please sign in to comment.