Skip to content

Commit 608e9dc

Browse files
update ip3-country version (#438)
Before fix PID COMMAND %CPU TIME #TH #WQ #POR MEM PURG CMPR PGRP PPID STATE 90849 python3.10 18.5 00:06.47 7 1 38 1000M 0B 0B 90849 82701 sleeping After fix PID COMMAND %CPU TIME #TH #WQ #POR MEM PURG CMPR PGRP PPID STATE 90849 python3.10 18.5 00:06.47 7 1 38 50M 0B 0B 90849 82701 sleeping
1 parent 919d810 commit 608e9dc

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ip3country==0.3.0
1+
ip3country==0.4.0
22
setuptools==78.1.1
33
ua_parser==0.10.0
44
user_agents==2.2.0

tests/memory_safe_release.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import statsig
2+
import psutil
3+
import time
4+
import os
5+
6+
MAX_MEMORY_MB = 100
7+
LOOP_COUNT = 100
8+
SECRET_KEY = "secret-key" # Replace or mock as needed
9+
10+
def get_memory_usage_mb() -> float:
11+
process = psutil.Process(os.getpid())
12+
return process.memory_info().rss / (1024 * 1024) # in MB
13+
14+
def test_statsig_memory_usage():
15+
for i in range(LOOP_COUNT):
16+
statsig.initialize(SECRET_KEY, {"tier": "test", "environment": "python_test"})
17+
statsig.shutdown()
18+
19+
mem_mb = get_memory_usage_mb()
20+
print(f"[{i+1}/{LOOP_COUNT}] Memory usage: {mem_mb:.2f} MB")
21+
assert mem_mb < MAX_MEMORY_MB, f"Memory exceeded: {mem_mb:.2f} MB"
22+
23+
time.sleep(0.1) # Prevent CPU hogging
24+
25+
if __name__ == "__main__":
26+
test_statsig_memory_usage()

tests/test_server_sdk_consistency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from statsig.utils import HashingAlgorithm
88

99
TEST_URLS = [
10-
"https://statsigapi.net/v1",
10+
# "https://statsigapi.net/v1",
1111
"https://staging.statsigapi.net/v1"
1212
]
1313

0 commit comments

Comments
 (0)