Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc1da7d589 |
@@ -1,3 +1,7 @@
|
||||
## 3.5.0 - 2024-02-29
|
||||
|
||||
1. - Adds a new `feature_flags_request_timeout_seconds` timeout parameter for feature flags which defaults to 3 seconds, updated from the default 10s for all other API calls.
|
||||
|
||||
## 3.4.2 - 2024-02-20
|
||||
|
||||
1. Add `historical_migration` option for bulk migration to PostHog Cloud.
|
||||
|
||||
@@ -18,6 +18,7 @@ personal_api_key = None # type: Optional[str]
|
||||
project_api_key = None # type: Optional[str]
|
||||
poll_interval = 30 # type: int
|
||||
disable_geoip = True # type: bool
|
||||
feature_flags_request_timeout_seconds = 3 # type: int
|
||||
|
||||
default_client = None # type: Optional[Client]
|
||||
|
||||
@@ -452,6 +453,7 @@ def _proxy(method, *args, **kwargs):
|
||||
poll_interval=poll_interval,
|
||||
disabled=disabled,
|
||||
disable_geoip=disable_geoip,
|
||||
feature_flags_request_timeout_seconds=feature_flags_request_timeout_seconds,
|
||||
)
|
||||
|
||||
# always set incase user changes it
|
||||
|
||||
+3
-1
@@ -50,6 +50,7 @@ class Client(object):
|
||||
disabled=False,
|
||||
disable_geoip=True,
|
||||
historical_migration=False,
|
||||
feature_flags_request_timeout_seconds=3,
|
||||
):
|
||||
self.queue = queue.Queue(max_queue_size)
|
||||
|
||||
@@ -70,6 +71,7 @@ class Client(object):
|
||||
self.group_type_mapping = None
|
||||
self.cohorts = None
|
||||
self.poll_interval = poll_interval
|
||||
self.feature_flags_request_timeout_seconds = feature_flags_request_timeout_seconds
|
||||
self.poller = None
|
||||
self.distinct_ids_feature_flags_reported = SizeLimitedDict(MAX_DICT_SIZE, set)
|
||||
self.disabled = disabled
|
||||
@@ -164,7 +166,7 @@ class Client(object):
|
||||
"group_properties": group_properties,
|
||||
"disable_geoip": disable_geoip,
|
||||
}
|
||||
resp_data = decide(self.api_key, self.host, timeout=10, **request_data)
|
||||
resp_data = decide(self.api_key, self.host, timeout=self.feature_flags_request_timeout_seconds, **request_data)
|
||||
|
||||
return resp_data
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"https://us-api.i.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="distinct_id",
|
||||
groups={},
|
||||
person_properties=None,
|
||||
@@ -335,6 +335,7 @@ class TestClient(unittest.TestCase):
|
||||
on_error=self.set_fail,
|
||||
personal_api_key=FAKE_TEST_API_KEY,
|
||||
disable_geoip=True,
|
||||
feature_flags_request_timeout_seconds=12,
|
||||
)
|
||||
success, msg = client.capture("distinct_id", "python test event", send_feature_flags=True, disable_geoip=False)
|
||||
client.flush()
|
||||
@@ -356,7 +357,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"https://us-api.i.posthog.com",
|
||||
timeout=10,
|
||||
timeout=12,
|
||||
distinct_id="distinct_id",
|
||||
groups={},
|
||||
person_properties=None,
|
||||
@@ -784,7 +785,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"https://us-api.i.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="some_id",
|
||||
groups={},
|
||||
person_properties={"distinct_id": "some_id"},
|
||||
@@ -796,7 +797,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"https://us-api.i.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="feature_enabled_distinct_id",
|
||||
groups={},
|
||||
person_properties={"distinct_id": "feature_enabled_distinct_id"},
|
||||
@@ -808,7 +809,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"https://us-api.i.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="all_flags_payloads_id",
|
||||
groups={},
|
||||
person_properties={"distinct_id": "all_flags_payloads_id"},
|
||||
@@ -844,7 +845,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"http://app2.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="some_id",
|
||||
groups={"company": "id:5", "instance": "app.posthog.com"},
|
||||
person_properties={"distinct_id": "some_id", "x1": "y1"},
|
||||
@@ -870,7 +871,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"http://app2.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="some_id",
|
||||
groups={"company": "id:5", "instance": "app.posthog.com"},
|
||||
person_properties={"distinct_id": "override"},
|
||||
@@ -887,7 +888,7 @@ class TestClient(unittest.TestCase):
|
||||
patch_decide.assert_called_with(
|
||||
"random_key",
|
||||
"http://app2.posthog.com",
|
||||
timeout=10,
|
||||
timeout=3,
|
||||
distinct_id="some_id",
|
||||
groups={},
|
||||
person_properties={"distinct_id": "some_id"},
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
VERSION = "3.4.2"
|
||||
VERSION = "3.5.0"
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(VERSION, end="") # noqa: T201
|
||||
|
||||
Reference in New Issue
Block a user