-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstress_test.py
More file actions
54 lines (42 loc) · 1.5 KB
/
Copy pathstress_test.py
File metadata and controls
54 lines (42 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import asyncio
import os
import shutil
from account_manager import AccountManager
from dispatcher import Dispatcher
from logger import logger
async def run_deep_test():
print("\n" + "="*50)
print(" ELYNDOR INTERACTIVE - DEEP STRESS TEST")
print("="*50 + "\n")
# 1. Setup mock accounts
am = AccountManager()
# 2. Initialize
print("[1/3] Initializing account pool...")
await am.initialize()
# 3. Create Dispatcher with 5 targets
targets = ["@user1", "@user2", "@user3", "@user4", "@user5"]
dispatcher = Dispatcher(am, targets)
# 4. Simulate a message
print("[2/3] Simulating new message arrival...")
message_data = {
"from_chat_id": -100123,
"message_id": 999
}
# 5. Run dispatcher
print("[3/3] Starting delivery with Chaos Mode enabled...")
print(" (Bot will randomly simulate failures and attempt to skip them)\n")
# We run the dispatcher in the background
asyncio.create_task(dispatcher.run())
# Enqueue the message
await dispatcher.enqueue(message_data)
# Wait for delivery to finish (or fail)
# We expect 5 deliveries, each taking 2-5 seconds
await asyncio.sleep(25)
print("\n" + "="*50)
print(" STRESS TEST COMPLETED")
print("="*50 + "\n")
# Cleanup metadata file created by trial lock
if os.path.exists(".session_metadata.dat"):
os.remove(".session_metadata.dat")
if __name__ == "__main__":
asyncio.run(run_deep_test())