File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from copy import deepcopy
4
4
from dataclasses import dataclass
5
+ from datetime import timedelta
5
6
from enum import Enum
6
7
from typing import Any
7
8
from typing import Callable
@@ -1209,9 +1210,10 @@ def decider_client_from_config(
1209
1210
``path`` (optional)
1210
1211
The path to the experiment configuration file generated by the
1211
1212
experiment configuration fetcher daemon.
1213
+ Defaults to :code:`"/var/local/experiments.json"`.
1212
1214
``timeout`` (optional)
1213
- The time that we should wait for the file specified by ``path`` to
1214
- exist. Defaults to `None` which is not blocking .
1215
+ The time that we should wait for the file specified by ``path`` to exist.
1216
+ Defaults to blocking for :code:`30` seconds .
1215
1217
``backoff`` (optional)
1216
1218
The base amount of time for exponential backoff when trying to find the
1217
1219
experiments config file. Defaults to no backoff between tries.
@@ -1231,7 +1233,7 @@ def decider_client_from_config(
1231
1233
{
1232
1234
config_prefix : {
1233
1235
"path" : config .Optional (config .String , default = "/var/local/experiments.json" ),
1234
- "timeout" : config .Optional (config .Timespan ),
1236
+ "timeout" : config .Optional (config .Timespan , default = timedelta ( seconds = 30 ) ),
1235
1237
"backoff" : config .Optional (config .Timespan ),
1236
1238
}
1237
1239
},
Original file line number Diff line number Diff line change @@ -88,14 +88,14 @@ def setUp(self):
88
88
self .mock_span = mock .MagicMock (spec = ServerSpan )
89
89
self .mock_span .context = None
90
90
91
- def test_make_clients (self , file_watcher_mock ):
91
+ def test_make_client_without_timeout_set (self , file_watcher_mock ):
92
92
with create_temp_config_file ({}) as f :
93
93
decider_ctx_factory = decider_client_from_config (
94
94
{"experiments.path" : f .name }, self .event_logger
95
95
)
96
96
self .assertIsInstance (decider_ctx_factory , DeciderContextFactory )
97
97
file_watcher_mock .assert_called_once_with (
98
- path = f .name , parser = init_decider_parser , timeout = None , backoff = None
98
+ path = f .name , parser = init_decider_parser , timeout = 30.0 , backoff = None
99
99
)
100
100
101
101
def test_timeout (self , file_watcher_mock ):
You can’t perform that action at this time.
0 commit comments