Skip to content

fix: node draining now properly completes at stop - #194

Merged
b3by merged 1 commit into
meetecho:mainfrom
b3by:fix/drain_on_stop
Aug 31, 2026
Merged

fix: node draining now properly completes at stop#194
b3by merged 1 commit into
meetecho:mainfrom
b3by:fix/drain_on_stop

Conversation

@b3by

@b3by b3by commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR addresses a unit test that occasionally fails, depending on the timing of the machine running the test. With the old implementation, any messages still in the queue or the buffer when the update thread exits would be dropped.

In order to implement this mechanism, a couple of missing primitives were added to the transport protocol, namely, wait() for the Signal, empty() and qsize() for the Queue. A timeout argument was also added to the put for the Queue class. Lastly, a JUTURNA_DRAIN_TIMEOUT` constant was introduced, to indicate how long a node should wait to drain its pending messages.

PR type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code refactoring
  • Performance improvement

Key modifications and changes

  • Slightly changed the stop() mechanism, so now the node truly waits to drain all pending messages
  • New primitives added to the transport protocol
  • New constant JUTUNRA_DRAIN_TIMEOUT added

Affected components

  • The Node class
  • The signatures for the transport Queue and Signal

@b3by
b3by requested a review from GaijinKa August 28, 2026 14:14
@b3by b3by added type:bug Something isn't working type:enhancement New feature or request priority:medium labels Aug 28, 2026
@b3by
b3by merged commit 4a6d8bb into meetecho:main Aug 31, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium type:bug Something isn't working type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants