Skip to content

Per-conversation monotonic sequence_number assignment #178

Description

@codebestia

Add lastSequenceNumber bigint to conversations (or a counter table) and assign each new message sequenceNumber = ++counter inside the same transaction that persists the message, using UPDATE ... RETURNING / row lock. Must be correct under concurrent senders and horizontal scaling.

Acceptance criteria:

  • Sequence numbers are gapless and strictly increasing per conversation
  • Concurrent sends do not produce duplicate sequence numbers
  • Assignment happens atomically with message persistence

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions