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

DataConsumer: Add addSubchannel() and removeSubchannel() #1263

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

ibc
Copy link
Member

@ibc ibc commented Dec 12, 2023

Details

  • Problem with dataConsumer.setSubchannels(subchannels) is that it's an async method and dataConsumer.subchannels getter doesn't get the updated value until setSubchannels() completes.
  • So next code is a bit problematic:
    dataConsumer.setSubchannels([ 1, 2, 3 ]); // Note that we are not awaiting for it to complete.
    
    // Now let's add subchannel 4:
    dataConsumer.setSubchannels([ ...dataConsumer.subchannels, 4 ]);
  • Resulting subchannels after this code are [ 4 ] rather than [ 1, 2, 3, 4 ] as one may expect.
  • So we are adding addSubchannel() and removeSubchannel() methods to make this more easier:
    dataConsumer.setSubchannels([ 1, 2, 3 ]); // Note that we are not awaiting for it to complete.
    
    // Now let's add subchannel 4:
    dataConsumer.addSubchannel(4);
  • Resulting subchannels after this code are [ 1, 2, 3, 4 ].

**TODO:** Rust, but I won't do it until #1262 is done and merged.
@ibc ibc requested a review from jmillan December 12, 2023 16:54
@ibc ibc marked this pull request as ready for review December 12, 2023 18:48
@ibc ibc requested a review from nazar-pc December 12, 2023 18:49
@ibc ibc changed the title DataConsumer: Add addSubchannel() and `removeSubchannel() DataConsumer: Add addSubchannel() and removeSubchannel() Dec 12, 2023
@ibc ibc merged commit e2e0622 into v3 Dec 12, 2023
36 checks passed
@ibc ibc deleted the add-and-remove-subchannel-methods branch December 12, 2023 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants