Skip to content

Commit 7743d61

Browse files
committed
improve thru put with better wait times
1 parent c98aaa3 commit 7743d61

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

convex_api/convex_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def send(self, transaction, account, language=None, sequence_retry_count=20):
6767
if sequence_retry_count == 0:
6868
raise
6969
sequence_retry_count -= 1
70-
# now sleep < 1 second for some random milli secconds
71-
sleep_time = (secrets.randbelow(max_sleep_time_seconds * 1000) + 1) / 1000
72-
time.sleep(sleep_time)
70+
# now sleep < 1 second for at least 1 millisecond
71+
sleep_time = secrets.randbelow(round(max_sleep_time_seconds * 1000)) / 1000
72+
time.sleep(sleep_time + 1)
7373
else:
7474
raise
7575
else:

tests/intergration/test_convex_multi_thread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def process_on_convex(convex, test_account):
1616
values = []
1717
inc_values = []
1818
is_sent = False
19-
for counter in range(0, secrets.randbelow(4) + 1):
19+
for counter in range(0, 4):
2020
for index in range(secrets.randbelow(10) + 1):
2121
value = secrets.randbelow(1000)
2222
values.append(str(value))
@@ -31,7 +31,7 @@ def process_on_convex(convex, test_account):
3131

3232
def test_convex_api_multi_thread(convex_url, test_account):
3333

34-
process_count = 8
34+
process_count = 4
3535
convex = ConvexAPI(convex_url)
3636
auto_topup_account(convex, test_account)
3737
process_list = []

0 commit comments

Comments
 (0)