Skip to content

Commit 6c1b931

Browse files
committed
refactor: Specify callback rate
1 parent 420ca23 commit 6c1b931

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/wrapper.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,19 @@ struct PySampler(SamplerState);
246246
fn make_callback(callback: Option<Py<PyAny>>) -> Option<ProgressCallback> {
247247
match callback {
248248
Some(callback) => {
249-
Some(Box::new(move |stats: Box<[ChainProgress]>| {
249+
let callback = Box::new(move |stats: Box<[ChainProgress]>| {
250250
let _ = Python::with_gil(|py| {
251251
let args = PyList::new_bound(
252252
py,
253253
stats.into_vec().into_iter().map(|prog| PyChainProgress(prog).into_py(py))
254254
);
255255
callback.call1(py, (args,))
256256
});
257-
}))
257+
});
258+
Some(ProgressCallback {
259+
callback,
260+
rate: Duration::from_millis(500),
261+
})
258262
},
259263
None => { None },
260264
}

0 commit comments

Comments
 (0)