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