Skip to content

Keep time-change votes durable until processing completes - #1676

Closed
BenCodez wants to merge 9 commits into
masterfrom
fix/time-queue-durable-processing-20260928
Closed

BenCodez wants to merge 9 commits into
masterfrom
fix/time-queue-durable-processing-20260928

Conversation

@BenCodez

@BenCodez BenCodez commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • persist newly queued time-change votes immediately
  • keep the persisted timed-vote snapshot until each individual event has finished
  • retain the current head when event processing throws and schedule the existing bounded retry path
  • remove only completed/cancelled entries from the durable snapshot
  • continue past a cancelled queued vote instead of stranding later entries
  • preserve the existing queued vote timestamp behavior already on master

Why

The previous path cleared TimedVoteCache as soon as the processing task was admitted, then removed each in-memory vote before firing its PlayerVoteEvent. A graceful failure after either step could leave no durable owner for work that had not completed.

This PR changes the queue to an at-least-once durable replay model for graceful failures: the head remains stored until its event returns. The existing hard-crash boundary around arbitrary reward side effects remains unchanged.

Persistence

ServerData.replaceTimedVoteCache(...) builds the full replacement snapshot in memory and calls saveData() once, rather than clearing the file in one save and rebuilding it through multiple subsequent saves.

Tests

  • newly queued vote is persisted immediately
  • listener failure retains the queue head
  • cancelled vote does not strand later queued votes
  • existing scheduler-rejection/retry coverage remains

Compatibility

  • no config migration
  • existing ServerData.yml timed-vote format is unchanged
  • no proxy transport behavior changes
  • does not include the timestamp typo fix; that is already fixed separately on master

Validation

Source-level review completed against current master. CI/build validation is pending.

Summary by CodeRabbit

  • Bug Fixes
    • Votes are saved as soon as they’re added, helping preserve queued votes if the server stops unexpectedly.
    • If a vote cannot be processed because of an error, it remains queued for a later retry instead of being lost.
    • A cancelled vote no longer prevents other queued votes from being processed.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 797f8946-5f73-4851-84bc-0c5981d10edb

📥 Commits

Reviewing files that changed from the base of the PR and between d22a611 and 5ac5286.

📒 Files selected for processing (3)
  • VotingPlugin/src/main/java/com/bencodez/votingplugin/data/ServerData.java
  • VotingPlugin/src/main/java/com/bencodez/votingplugin/timequeue/TimeQueueHandler.java
  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/timequeue/TimeQueueHandlerRejectionTest.java
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BenCodez BenCodez closed this Sep 29, 2026
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