Skip to content

Preserve FIFO order when pausing HelperCustomQueue - #70

Open
Niketion wants to merge 1 commit into
visualHFT:masterfrom
Niketion:fix/helper-custom-queue-preserve-fifo-on-pause
Open

Preserve FIFO order when pausing HelperCustomQueue#70
Niketion wants to merge 1 commit into
visualHFT:masterfrom
Niketion:fix/helper-custom-queue-preserve-fifo-on-pause

Conversation

@Niketion

@Niketion Niketion commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • Check the pause state before reading the next item from HelperCustomQueue<T>.
  • Remove the mid-batch path that re-enqueued an already-dequeued item.
  • Add focused regression tests for pausing during a batch and before enqueueing.

Root cause

The consumer previously dequeued an item before checking whether a pause had been requested. When paused, it wrote that item back to the same channel.

Re-enqueueing moved the item behind entries already in the channel, so an ordered sequence such as A, B, C could be processed as A, C, B.

This is particularly problematic for ordered market-data streams and exchange sequence handling.

Behavior

The consumer now checks the pause state before claiming the next item. An item already claimed because of a concurrent pause is processed once, and the following loop iteration observes the pause.

No shutdown, disposal, public API, monitoring, or connector behavior is changed.

Tests

  • PauseDuringBatch_PreservesFifoOrder
  • PauseBeforeEnqueue_DoesNotProcessUntilResume

Validation completed:

  • Commons tests: 2 passed
  • MarketResilience tests: 53 passed
  • MarketData connector tests: 18 passed
  • VisualHFT.Commons build: passed

@Niketion
Niketion marked this pull request as ready for review August 6, 2026 10:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30e89e985d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread VisualHFT.Commons/Helpers/HelperCustomQueue.cs
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.

1 participant