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

Adding a batchSize and applying extrinsics per batch #2728

Merged
merged 9 commits into from
May 27, 2024

Conversation

maayarosama
Copy link
Contributor

@maayarosama maayarosama commented May 19, 2024

Description

Adding a batch size to batchCancelContracts method. so instead of canceling all contracts at once, they get canceled in batches

Changes

  • Adding a batch size and applyAllExtrinsics per batch

Related Issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

Copy link
Contributor

@AhmedHanafy725 AhmedHanafy725 left a comment

Choose a reason for hiding this comment

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

This should be applied to all extrinsic methods not only canceling contracts. I suggest it to be done in utility methods (batch, batchAll) here

@@ -12,21 +12,37 @@ class Utility {
@checkConnection
async batch<T>(extrinsics: ExtrinsicResult<T>[]): Promise<T[]> {
extrinsics = extrinsics.filter(Boolean);
const batchSize = 400;
Copy link
Contributor

Choose a reason for hiding this comment

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

move this constant outside the method to be global in this module

@@ -323,6 +323,7 @@ class TFContracts extends Contracts {
extrinsics.push(await this.cancel({ id }));
}
await this.client.applyAllExtrinsics(extrinsics);

Copy link
Member

Choose a reason for hiding this comment

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

@maayarosama remove this file as it got no changes

packages/tfchain_client/src/utility.ts Outdated Show resolved Hide resolved
packages/tfchain_client/src/utility.ts Outdated Show resolved Hide resolved
@maayarosama maayarosama merged commit 90c5c5a into development May 27, 2024
2 checks passed
@maayarosama maayarosama deleted the development_batch_cancel_contracts branch May 27, 2024 13:17
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