wildedge-python icon indicating copy to clipboard operation
wildedge-python copied to clipboard

close() stops the attachment uploader without uploading pending attachments

Open piotrekno1 opened this issue 1 month ago • 0 comments

What happens

WildEdge.close() (wildedge/client.py:1000) calls AttachmentUploader.stop() (wildedge/attachments.py), which only sets the stop event and joins the thread. The uploader runs process_pending() every DEFAULT_ATTACHMENT_FLUSH_INTERVAL_SEC (5 s), so attachments registered in the last few seconds before shutdown are not uploaded. close(timeout=...) flushes events but not attachments.

They stay in the on-disk store and go out on the next start, if there is one and they are still within max_age_s. For short-lived processes (CLI runs, scripts, a kiosk app stopped with Ctrl-C) this means the last exchanges' attachments are missing, while their events reference them (attachment_count > 0).

Verified: after close(timeout=1.5) the attachments were missing; calling client.attachment_uploader.process_pending() manually before close uploaded them.

Expected

When close(timeout=...) / flush(timeout=...) is given a timeout, run a final process_pending() (bounded by the remaining timeout) before stopping the thread. Without a timeout, keep today's fast shutdown.

SDK 0.2.2.

🤖 Generated with Claude Code

piotrekno1 avatar Oct 19 '26 19:10 piotrekno1