Skip to content

Conversation

@lukevalenta
Copy link
Contributor

  • Durable Object methods no longer take a mutable reference, so we need to use interior mutability (RefCell) to update state, as recommended by the workers-rs maintainers. The tricky part is avoiding passing a borrowed Ref to an async function, as that could cause a panic if, for example, a concurrent async operation attempts to borrow an already-mutably-borrowed value.
  • To simplify the above change, remove the Option wrapper from the GenericSequencer's 'sequence_state' field. Instead of loading the sequencer state just-in-time for the first sequencing, load it during the DO initialization (which happens after the first fetch or alarm). Similarly, when there is a fatal sequencing error requiring reloading the sequence state, load the state right away rather than waiting for the next sequencing.

@lukevalenta lukevalenta self-assigned this Jul 17, 2025
@lukevalenta lukevalenta requested a review from bwesterb July 17, 2025 18:43
@lukevalenta
Copy link
Contributor Author

@rozbb fyi

- Durable Object methods no longer take a mutable reference, so we need
  to use interior mutability (RefCell) to update state, as recommended
  by the workers-rs maintainers. The tricky part is avoiding passing a
  borrowed Ref to an async function, as that could cause a panic if, for
  example, a concurrent async operation attempts to borrow an
  already-mutably-borrowed value.
- To simplify the above change, remove the Option wrapper from the
  GenericSequencer's 'sequence_state' field. Instead of loading the
  sequencer state just-in-time for the first sequencing, load it during
  the DO initialization (which happens after the first fetch or alarm).
  Similarly, when there is a fatal sequencing error requiring reloading
  the sequence state, load the state right away rather than waiting for
  the next sequencing.
@lukevalenta lukevalenta force-pushed the lvalenta/worker-0.6.0 branch from fe6b7a4 to 286cd54 Compare July 17, 2025 19:22
@lukevalenta lukevalenta merged commit f10355f into main Jul 21, 2025
1 check passed
@lukevalenta lukevalenta deleted the lvalenta/worker-0.6.0 branch July 21, 2025 13:01
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.

2 participants