Skip to content

Conversation

vincent-pochet
Copy link
Collaborator

Context

This PR is a new attempt to approach the issue of parallel wallet refresh refresh in the case of in payed in advance events.

Description

The PR moves fro pessimistic locking (FOR UPDATE NOWAIT) to an optimistic one using the lock_version already present on the wallets table.
An automatic retry logic is added around the wallet decrease logic with a random wait time between each attempt. It reduce the effect of the error to the decrease logic only instead of the all event processing like it is today.
Finally in case of error, the error is re-raised and the entire logic will be retried by Sidekiq

Copy link
Collaborator

@rsempe rsempe left a comment

Choose a reason for hiding this comment

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

lgtm!

@vincent-pochet vincent-pochet merged commit 3a84728 into main May 26, 2025
14 checks passed
@vincent-pochet vincent-pochet deleted the fix-wallet-in-advance branch May 26, 2025 13:33
vincent-pochet added a commit that referenced this pull request May 26, 2025
This PR is a new attempt to approach the issue of parallel wallet
refresh refresh in the case of in payed in advance events.

The PR moves fro pessimistic locking (`FOR UPDATE NOWAIT`) to an
optimistic one using the `lock_version` already present on the wallets
table.
An automatic retry logic is added around the wallet decrease logic with
a random wait time between each attempt. It reduce the effect of the
error to the decrease logic only instead of the all event processing
like it is today.
Finally in case of error, the error is re-raised and the entire logic
will be retried by Sidekiq
vincent-pochet added a commit that referenced this pull request May 26, 2025
This PR is a new attempt to approach the issue of parallel wallet
refresh refresh in the case of in payed in advance events.

The PR moves fro pessimistic locking (`FOR UPDATE NOWAIT`) to an
optimistic one using the `lock_version` already present on the wallets
table.
An automatic retry logic is added around the wallet decrease logic with
a random wait time between each attempt. It reduce the effect of the
error to the decrease logic only instead of the all event processing
like it is today.
Finally in case of error, the error is re-raised and the entire logic
will be retried by Sidekiq
vincent-pochet added a commit that referenced this pull request May 26, 2025
… (#3722)

This PR removes the legacy `organizations.clickhouse_aggregation`
column, that is not used anymore.
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.

4 participants