@@ -30,7 +30,6 @@ use crate::setting::{Setting, SettingValue};
3030
3131const SENDER_ID : u16 = 0x42 ;
3232const NUM_WORKERS : usize = 10 ;
33- const SETTINGS_WRITE_TIMEOUT_MS : u64 = 1000 ;
3433
3534pub struct Client < ' a > {
3635 link : Link < ' a , ( ) > ,
@@ -74,8 +73,7 @@ impl<'a> Client<'a> {
7473 name : impl Into < String > ,
7574 value : impl Into < String > ,
7675 ) -> Result < Entry , Error > {
77- let ( ctx, _ctx_handle) =
78- Context :: with_timeout ( Duration :: from_millis ( SETTINGS_WRITE_TIMEOUT_MS ) ) ;
76+ let ( ctx, _ctx_handle) = Context :: new ( ) ;
7977 self . write_setting_ctx ( group, name, value, ctx)
8078 }
8179
@@ -89,6 +87,17 @@ impl<'a> Client<'a> {
8987 self . write_setting_inner ( group. into ( ) , name. into ( ) , value. into ( ) , ctx)
9088 }
9189
90+ pub fn write_setting_with_timeout (
91+ & mut self ,
92+ group : impl Into < String > ,
93+ name : impl Into < String > ,
94+ value : impl Into < String > ,
95+ timeout : Duration ,
96+ ) -> Result < Entry , Error > {
97+ let ( ctx, _ctx_handle) = Context :: with_timeout ( timeout) ;
98+ self . write_setting_ctx ( group, name, value, ctx)
99+ }
100+
92101 pub fn read_setting (
93102 & mut self ,
94103 group : impl Into < String > ,
@@ -98,6 +107,16 @@ impl<'a> Client<'a> {
98107 self . read_setting_ctx ( group, name, ctx)
99108 }
100109
110+ pub fn read_setting_with_timeout (
111+ & mut self ,
112+ group : impl Into < String > ,
113+ name : impl Into < String > ,
114+ timeout : Duration ,
115+ ) -> Result < Option < Entry > , Error > {
116+ let ( ctx, _ctx_handle) = Context :: with_timeout ( timeout) ;
117+ self . read_setting_ctx ( group, name, ctx)
118+ }
119+
101120 pub fn read_setting_ctx (
102121 & mut self ,
103122 group : impl Into < String > ,
0 commit comments