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
@@ -1209,9 +1210,10 @@ def decider_client_from_config(
12091210 ``path`` (optional)
12101211 The path to the experiment configuration file generated by the
12111212 experiment configuration fetcher daemon.
1213+ Defaults to :code:`"/var/local/experiments.json"`.
12121214 ``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 .
12151217 ``backoff`` (optional)
12161218 The base amount of time for exponential backoff when trying to find the
12171219 experiments config file. Defaults to no backoff between tries.
@@ -1231,7 +1233,7 @@ def decider_client_from_config(
12311233 {
12321234 config_prefix : {
12331235 "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 ) ),
12351237 "backoff" : config .Optional (config .Timespan ),
12361238 }
12371239 },
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