refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
54
dev/scripts/testing/ws_load_test.py.bak
Executable file
54
dev/scripts/testing/ws_load_test.py.bak
Executable file
@@ -0,0 +1,54 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import List
|
||||
|
||||
import websockets
|
||||
|
||||
DEFAULT_WS_URL = "ws://127.0.0.1:8000/rpc/ws"
|
||||
BLOCK_TOPIC = "/blocks"
|
||||
TRANSACTION_TOPIC = "/transactions"
|
||||
|
||||
|
||||
async def producer(ws_url: str, interval: float = 0.1, total: int = 100) -> None:
|
||||
async with websockets.connect(f"{ws_url}{BLOCK_TOPIC}") as websocket:
|
||||
for index in range(total):
|
||||
payload = {
|
||||
"height": index,
|
||||
"hash": f"0x{index:064x}",
|
||||
"parent_hash": f"0x{index-1:064x}",
|
||||
"timestamp": "2025-01-01T00:00:00Z",
|
||||
"tx_count": 0,
|
||||
}
|
||||
await websocket.send(json.dumps(payload))
|
||||
await asyncio.sleep(interval)
|
||||
|
||||
|
||||
async def consumer(name: str, ws_url: str, path: str, duration: float = 5.0) -> None:
|
||||
async with websockets.connect(f"{ws_url}{path}") as websocket:
|
||||
end = asyncio.get_event_loop().time() + duration
|
||||
received = 0
|
||||
while asyncio.get_event_loop().time() < end:
|
||||
try:
|
||||
message = await asyncio.wait_for(websocket.recv(), timeout=1.0)
|
||||
except asyncio.TimeoutError:
|
||||
continue
|
||||
received += 1
|
||||
if received % 10 == 0:
|
||||
print(f"[{name}] received {received} messages")
|
||||
print(f"[{name}] total received: {received}")
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
ws_url = DEFAULT_WS_URL
|
||||
consumers = [
|
||||
consumer("blocks-consumer", ws_url, BLOCK_TOPIC),
|
||||
consumer("tx-consumer", ws_url, TRANSACTION_TOPIC),
|
||||
]
|
||||
await asyncio.gather(producer(ws_url), *consumers)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user