Skip to content

Commit 901f1fe

Browse files
committed
Fix Rust code
1 parent 29ea0d7 commit 901f1fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rust/src/rendezvous/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use mime::Mime;
2828
use pyo3::{
2929
exceptions::PyValueError,
3030
pyclass, pymethods,
31-
types::{PyAnyMethods, PyModule, PyModuleMethods},
31+
types::{IntoPyDict, PyAnyMethods, PyModule, PyModuleMethods},
3232
Bound, IntoPyObject, Py, PyAny, PyResult, Python,
3333
};
3434
use ulid::Ulid;
@@ -132,6 +132,11 @@ impl RendezvousHandler {
132132
.unwrap_infallible()
133133
.unbind();
134134

135+
let duration_module = py.import("synapse.util.duration")?;
136+
137+
let kwargs = [("milliseconds", eviction_interval)].into_py_dict(py)?;
138+
let eviction_duration = duration_module.call_method("Duration", (), Some(&kwargs))?;
139+
135140
// Construct a Python object so that we can get a reference to the
136141
// evict method and schedule it to run.
137142
let self_ = Py::new(
@@ -149,7 +154,7 @@ impl RendezvousHandler {
149154
let evict = self_.getattr(py, "_evict")?;
150155
homeserver.call_method0("get_clock")?.call_method(
151156
"looping_call",
152-
(evict, eviction_interval),
157+
(evict, eviction_duration),
153158
None,
154159
)?;
155160

0 commit comments

Comments
 (0)