Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor transaction handler. #20

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

Half-Shot
Copy link
Member

@Half-Shot Half-Shot commented Jun 29, 2023

Fixes turt2live#327

This:

  • Moves the actual transaction handling logic to it's own function.
  • Uses a Map to store the txnId => Promise .
  • Always clears up transactions after they've run.

@Half-Shot Half-Shot requested a review from a team as a code owner June 29, 2023 13:02

try {
await this.pendingTransactions[txnId];
await txnHandler;
await Promise.resolve(this.storage.setTransactionCompleted(txnId));
Copy link

Choose a reason for hiding this comment

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

Not strictly related to this PR, but this await Promise.resolve is a bit superfluous, and a bit confusing.

Copy link

@tadzik tadzik left a comment

Choose a reason for hiding this comment

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

No complaints, looks good to me.

@Half-Shot Half-Shot merged commit cfae65f into element-hq:main Jul 3, 2023
7 checks passed
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.

Appservice.pendingTransactions accumulates over time
2 participants