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

Unreliable storage subscriptions #186

Open
clangenb opened this issue Oct 12, 2021 · 4 comments
Open

Unreliable storage subscriptions #186

clangenb opened this issue Oct 12, 2021 · 4 comments

Comments

@clangenb
Copy link
Member

clangenb commented Oct 12, 2021

I am subscribing to storage double-map values via polkadot-js-api. In some cases, there seems to be no subscription updates, depending on the operation performed in the pallet.

  • i get updates when double_map::remove_prefix is used, triggered by scheduler pallet
  • i seem to consistently not get updates when double_map::insert is used triggered by an extrinsic

I could observe this so far for the ParticipantIndex

@brenzi
Copy link
Member

brenzi commented Oct 12, 2021

I believe double map can't be subscribed with only the primary prefix. You can only subscribe to specific values, so insert doesn't trigger as it doesn't affect an existing value (only mutate would)
I think this behavior you describe works as designed

@brenzi
Copy link
Member

brenzi commented Oct 12, 2021

hmm, but the change from None to Some participant index should trigger, actually

@clangenb
Copy link
Member Author

I have asked in substrate-technical, let's see if an answer comes. We are not too reliant on this anyhow. I also doubt if a subscription makes sens in some cases where we only occasionally get updates. It might be better to fetch the updates, when necessary.

@brenzi
Copy link
Member

brenzi commented Oct 14, 2021

well, a reactive design relies on subscriptions, not polling. So I do prefer the current model

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

No branches or pull requests

2 participants