File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 22
33from copy import deepcopy
44from dataclasses import dataclass
5+ from datetime import timedelta
56from enum import Enum
67from typing import Any
78from typing import Callable
@@ -1193,9 +1194,10 @@ def decider_client_from_config(
11931194 ``path`` (optional)
11941195 The path to the experiment configuration file generated by the
11951196 experiment configuration fetcher daemon.
1197+ Defaults to :code:`"/var/local/experiments.json"`.
11961198 ``timeout`` (optional)
1197- The time that we should wait for the file specified by ``path`` to
1198- exist. Defaults to `None` which is not blocking .
1199+ The time that we should wait for the file specified by ``path`` to exist.
1200+ Defaults to blocking for :code:`30` seconds .
11991201 ``backoff`` (optional)
12001202 The base amount of time for exponential backoff when trying to find the
12011203 experiments config file. Defaults to no backoff between tries.
@@ -1215,7 +1217,7 @@ def decider_client_from_config(
12151217 {
12161218 config_prefix : {
12171219 "path" : config .Optional (config .String , default = "/var/local/experiments.json" ),
1218- "timeout" : config .Optional (config .Timespan ),
1220+ "timeout" : config .Optional (config .Timespan , default = timedelta ( seconds = 30 ) ),
12191221 "backoff" : config .Optional (config .Timespan ),
12201222 }
12211223 },
Original file line number Diff line number Diff line change @@ -88,14 +88,14 @@ def setUp(self):
8888 self .mock_span = mock .MagicMock (spec = ServerSpan )
8989 self .mock_span .context = None
9090
91- def test_make_clients (self , file_watcher_mock ):
91+ def test_make_client_without_timeout_set (self , file_watcher_mock ):
9292 with create_temp_config_file ({}) as f :
9393 decider_ctx_factory = decider_client_from_config (
9494 {"experiments.path" : f .name }, self .event_logger
9595 )
9696 self .assertIsInstance (decider_ctx_factory , DeciderContextFactory )
9797 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
9999 )
100100
101101 def test_timeout (self , file_watcher_mock ):
You can’t perform that action at this time.
0 commit comments