Skip to content

Add configurable mailbox flushing on terminate#28

Merged
kjnilsson merged 1 commit intomasterfrom
configurable-mailbox-flush
Mar 31, 2026
Merged

Add configurable mailbox flushing on terminate#28
kjnilsson merged 1 commit intomasterfrom
configurable-mailbox-flush

Conversation

@kjnilsson
Copy link
Copy Markdown
Contributor

Introduce the flush_mailbox_on_terminate option (type: false | {true, N}, default: false). When enabled, up to N pending mailbox messages and the total mailbox count are written to the process dictionary under the key mailbox_summary before the process exits. The remaining messages are then drained to prevent proc_lib crash reports from pretty-printing potentially large payloads.
The flush now happens before Module:terminate/2 is called at all exit points, so the terminate callback can inspect or forward the summary. Add two CT test cases covering the disabled (default) and enabled paths, and document the new option in the README.

Introduce the flush_mailbox_on_terminate option (type: false | {true, N},
default: false). When enabled, up to N pending mailbox messages and the
total mailbox count are written to the process dictionary under the key
mailbox_summary before the process exits. The remaining messages are then
drained to prevent proc_lib crash reports from pretty-printing potentially
large payloads.
The flush now happens before Module:terminate/2 is called at all exit
points, so the terminate callback can inspect or forward the summary.
Add two CT test cases covering the disabled (default) and enabled paths,
and document the new option in the README.
@kjnilsson kjnilsson force-pushed the configurable-mailbox-flush branch from 2a6d74b to cd24b3b Compare March 31, 2026 12:04
@kjnilsson kjnilsson marked this pull request as ready for review March 31, 2026 13:20
@kjnilsson kjnilsson merged commit 58504b6 into master Mar 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants