Skip to content

Flux#sampleFirst(Duration) marble diagram does not match implementation semantics #4173

@oliviercoma

Description

@oliviercoma

Documentation Issue

The marble diagram for Flux#sampleFirst(Duration) do not match the actual behavior implemented in FluxSampleFirst.

Observed behavior (from FluxSampleFirst source):

  • The delay window starts only after the first element is emitted (not on subscribe() and not on request()).
  • When the gate is open, the element is emitted immediately, not delayed until the end of the sampling period.
  • Any element emitted while the gate is closed is discarded.
  • No element is emitted when the delay expires (ie there is no “last seen” / trailing emission).

This behavior matches the semantics of sampleFirst(Publisher<?> sampler), whose marble diagram is correct.

However, the marble diagram for sampleFirst(Duration) currently suggests:

  • a timer starting on request()
  • a trailing emission at timer expiration,
    neither of which are implemented.

Improvement Suggestion

Marble diagram should be updated to match implemented semantic

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions