fix(bot-relay): sweep stale relay artifacts + never leak the deliver tempfile
Widen the DM tempfile-leak fix (#91902/#92407) to the sibling sites PR #92784 introduced: - tools/bot_relay.py: expose the 6h stale sweep as cleanup_bot_relay_artifacts() (cleanup_*_cache contract) and wire it into gateway housekeeping — previously it ran only when the Desktop drained the outbox, so plaintext envelopes/replies queued while the Desktop was away could sit on disk forever. - tui_gateway/methods_bot_relay.py: move the payload write inside the try/finally so a failed write no longer leaks hermes-relay-dm-*.txt. - tools/bot_mode_dm.py: _spawn_delivery takes dm_file=None for relay waiter deliveries, which have no plaintext DM tempfile to reclaim.
This commit is contained in:
@@ -110,9 +110,9 @@ def _(rid, params: dict) -> dict:
|
||||
return _err(rid, 4092, f"no profile '{profile}' on this gateway")
|
||||
|
||||
fd, tmp = tempfile.mkstemp(prefix="hermes-relay-dm-", suffix=".txt", text=True)
|
||||
with os.fdopen(fd, "w", encoding="utf-8") as f:
|
||||
f.write(message)
|
||||
try:
|
||||
with os.fdopen(fd, "w", encoding="utf-8") as f:
|
||||
f.write(message)
|
||||
proc = subprocess.run(
|
||||
local_delivery_command(resolved, tmp),
|
||||
capture_output=True,
|
||||
|
||||
Reference in New Issue
Block a user