@@ -44,6 +44,7 @@ impl Manager {
44
44
bind : String ,
45
45
store_addr : String ,
46
46
world_size : u64 ,
47
+ heartbeat_interval : Duration ,
47
48
) -> PyResult < Self > {
48
49
py. allow_threads ( move || {
49
50
let runtime = Runtime :: new ( ) ?;
@@ -55,6 +56,7 @@ impl Manager {
55
56
bind,
56
57
store_addr,
57
58
world_size,
59
+ heartbeat_interval,
58
60
) )
59
61
. map_err ( |e| PyRuntimeError :: new_err ( e. to_string ( ) ) ) ?;
60
62
let handle = runtime. spawn ( manager. clone ( ) . run ( ) ) ;
@@ -224,16 +226,19 @@ struct Lighthouse {
224
226
225
227
#[ pymethods]
226
228
impl Lighthouse {
229
+ #[ pyo3( signature = ( bind, min_replicas, join_timeout_ms=None , quorum_tick_ms=None , heartbeat_timeout_ms=None ) ) ]
227
230
#[ new]
228
231
fn new (
229
232
py : Python < ' _ > ,
230
233
bind : String ,
231
234
min_replicas : u64 ,
232
235
join_timeout_ms : Option < u64 > ,
233
236
quorum_tick_ms : Option < u64 > ,
237
+ heartbeat_timeout_ms : Option < u64 > ,
234
238
) -> PyResult < Self > {
235
239
let join_timeout_ms = join_timeout_ms. unwrap_or ( 100 ) ;
236
240
let quorum_tick_ms = quorum_tick_ms. unwrap_or ( 100 ) ;
241
+ let heartbeat_timeout_ms = heartbeat_timeout_ms. unwrap_or ( 5000 ) ;
237
242
238
243
py. allow_threads ( move || {
239
244
let rt = Runtime :: new ( ) ?;
@@ -244,6 +249,7 @@ impl Lighthouse {
244
249
min_replicas : min_replicas,
245
250
join_timeout_ms : join_timeout_ms,
246
251
quorum_tick_ms : quorum_tick_ms,
252
+ heartbeat_timeout_ms : heartbeat_timeout_ms,
247
253
} ) )
248
254
. map_err ( |e| PyRuntimeError :: new_err ( e. to_string ( ) ) ) ?;
249
255
0 commit comments