Skip to content

[BUGFIX] Lock the counter of the order, invoice and delivery numbers - #883

Merged
d-g-codappix merged 1 commit into
11.xfrom
number-lock-for-v11
Nov 23, 2026
Merged

d-g-codappix merged 1 commit into
11.xfrom
number-lock-for-v11

Conversation

@d-g-codappix

Copy link
Copy Markdown
Collaborator

Resolves: #881

The counter of the order, invoice and delivery numbers is read and incremented in one database transaction with a locked row (SELECT ... FOR UPDATE) in sys_registry, so concurrent orders never get the same number. Existing counters are continued.

  • New class Extcode\Cart\Domain\Order\Number\NumberCounter. SQLite does not support FOR UPDATE, there a write locks the database until the commit.
  • If two requests create a new counter at the same time, the unique key violation is retried (up to three times).
  • The TYPO3 Registry is no longer used, because it caches the entries for the whole request.
  • Number gets NumberCounter as optional fourth constructor argument, subclasses calling parent::__construct() with three arguments keep working.

The counter is read and incremented in one database transaction with
a locked row in sys_registry, so concurrent orders never get the same
number. The TYPO3 Registry is no longer used, because it caches the
entries for the whole request.

Resolves: #881

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@d-g-codappix
d-g-codappix merged commit 66e946f into 11.x Nov 23, 2026
21 checks passed
@d-g-codappix
d-g-codappix deleted the number-lock-for-v11 branch November 23, 2026 20:23
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