Skip to content

Add true trailing-edge debounce scheduler #21

Description

@dombrovsky

Summary

Add a true trailing-edge debounce policy that waits for a quiet interval and eventually executes the latest submitted operation. This must be distinct from the current leading-edge rejection policy, which is being named WithThrottle.

Design questions

  • Is the quiet interval measured from the most recent Enqueue call, including time spent waiting behind existing work?
  • How do superseded operation tasks complete: canceled, faulted with a dedicated exception, or linked to the latest result?
  • Does a newer submission cancel only pending work, or also request cancellation of an operation that has already started?
  • Does the debounce timer occupy the underlying sequential lane while it waits?
  • How are pending debounce operations owned and canceled when the underlying flow is disposed?
  • How should generic result types and caller cancellation compose across replacements?
  • How should exact interval-boundary races be resolved?

Acceptance criteria

  • The API and XML documentation define trailing-edge behavior precisely and distinguish it from throttling and CreateCancelPrevious.
  • Rapid submissions invoke only the final eligible delegate after the configured quiet interval.
  • Superseded returned tasks have deterministic, documented completion behavior.
  • Caller cancellation and flow disposal cannot leave pending tasks incomplete.
  • The implementation is thread-safe and uses TimeProvider for deterministic timing.
  • Tests cover TaskFlow and DedicatedThreadTaskFlow, exact-boundary races, cancellation, disposal, delegate failures, and supported target frameworks.
  • Examples avoid ambiguous Task<T>/ValueTask<T> async lambdas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions