Skip to content

Commit aead2a0

Browse files
committed
refactor wait_for_future to use Duration for signal check interval
1 parent 8c50e7f commit aead2a0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/utils.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,13 @@ where
6565
F::Output: Send + 'static,
6666
{
6767
let (runtime, _enter_guard) = get_and_enter_tokio_runtime();
68-
// Define the interval for checking Python signals
69-
const SIGNAL_CHECK_INTERVAL_MS: u64 = 1000;
68+
// Define the milisecond interval for checking Python signals
69+
const SIGNAL_CHECK_INTERVAL: Duration = Duration::from_millis(1_000);
7070

7171
// Release the GIL and directly block on the future with periodic signal checks
7272
py.allow_threads(|| {
7373
runtime.block_on(async {
74-
let mut interval =
75-
tokio::time::interval(Duration::from_millis(SIGNAL_CHECK_INTERVAL_MS));
74+
let mut interval = tokio::time::interval(SIGNAL_CHECK_INTERVAL);
7675

7776
// tokio::pin!(f) ensures we can select! between the future
7877
// and interval.tick() without moving f.

0 commit comments

Comments
 (0)