mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
5270f25ac1
Server: - Storage: #BakaShrot_Storage_SqliteLibrary, the SQLite the server loads: sqlite3.dll on Windows, the system's libsqlite3.so.0 on Linux (PB 5.73's bundled 3.33 has no JSON functions). The query error check and the writer's prepared statements use it too, so a JSON function on a row that isn't JSON is refused on Linux as well, not answered with no rows. - SendPacket: SendNetworkData() returns -1 once the send buffer is full (EAGAIN on Linux), which aborted clients reading big answers. Retried until nothing goes out for #BakaShrot_SendStallTimeout (10 s). Tests, timing they relied on: - Attachments, BigMessages: link failures before the first link are expected, Linux refuses at once where Windows retries for ~1 s. - Restart: a pusher whose server is killed between two pushes sees 100 (NotConnected), during one 104 (ConnectionLost): both accepted. - Retention: deletions counted over every retention check, a batch can be split over two. - AttachmentEdges: waits for B's corrupted attachment to be dropped, A sends it again at every check-in. All tests pass on Linux with PB 6.41 (asm and C backends). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RwFeVQCBfcPDfAPqX8z2TF
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""Pushes as fast as the server acknowledges, for Tests/Restart-Test.ps1.
|
|
|
|
Usage: restart_pusher.py <BakaShrot_Client.dll> <client.ini> <stop file> <out file> <tag>
|
|
Pushes {"by": tag, "seq": n} to the client's DefaultTopic until the stop
|
|
file exists, writing "<message id> <seq>" to the out file once each push is
|
|
acknowledged. Ends with "STOPPED", or "ERR <code> <why>" when the server
|
|
goes away (the test kills it; code 104, ConnectionLost, during a push, or
|
|
100, NotConnected, between two): what was
|
|
acknowledged before is what must survive.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Interactors", "Python"))
|
|
from bakashrot import BakaShrotError, Client # noqa: E402
|
|
|
|
dll_path, ini_path, stop_path, out_path, tag = sys.argv[1:6]
|
|
|
|
client = Client.from_ini(ini_path, dll_path)
|
|
with open(out_path, "a", buffering=1) as out:
|
|
try:
|
|
client.connect()
|
|
seq = 0
|
|
while not os.path.exists(stop_path):
|
|
seq += 1
|
|
message_id = client.push({"by": tag, "seq": seq})
|
|
out.write(f"{message_id} {seq}\n")
|
|
out.write("STOPPED\n")
|
|
except BakaShrotError as error:
|
|
out.write(f"ERR {int(error.code)} {type(error).__name__}: {error}\n")
|
|
finally:
|
|
try:
|
|
client.close()
|
|
except BakaShrotError:
|
|
pass
|