question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multi-query seems to not update cache for boolean value.

See original GitHub issue

I have a storage item:

map T:Account => bool

I use a .multi query to fetch the boolean value for all the members. This multi-query seems to update when the value goes from false -> true, but does not update when going from true -> false.

(It may be relevant to note that we never actually store false, we just remove the storage item, but it should return false on default).

You can see the behavior here with inline comments:

image

The image shows:

  • Initially both users are suspended ([true, true]), (correct)
  • We un-suspend one of them
  • A new .multi query still returns [true, true], (incorrect)
  • If you query the value of the un-suspended member separately, you get false (correct)
  • Then if you multi-query again, you get the correct result of [false, true]. (correct)

Not this issue does not appear when going from false -> true. Only true -> false.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jacogrcommented, Jan 19, 2020

In polkadot-js stuff, we generally stay about from the above hooks when dealing with anything UI. In cases where it is re-usable and especially when it is useful to others, we move them to derives where we use RxJs.

For instance, the logic for the society member retrieval - https://github.com/polkadot-js/api/blob/master/packages/api-derive/src/society/member.ts#L23 (Still early, but should give through the concept of the splits employed there)

Can also ve done with the promise-specific api.combineLatest (which basically does what combineLatest does, with subscriptions and unsubscribes so it updates and the status changes)

0reactions
polkadot-js-botcommented, Jun 4, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscription to multiple entries in a double map does not ...
Subscription to multiple entries in a double map does not reflect calls to remove_prefix #1417 ... Multi-query seems to not update cache for...
Read more >
java - Updating a boolean value in multithreaded process
Multiple threads are trying to access that boolean at the same time: a race condition while updating the same variable.
Read more >
MySQL bugs fixed by Aurora MySQL database engine ...
Bug #25289359 : A full-text cache lock taken when data is synchronized was not released if the full-text cache size exceeded the full-text...
Read more >
Server-side caching - Apollo GraphQL Docs
Our philosophy behind Apollo Server caching is that a response should only be considered cacheable if every part of that response opts in...
Read more >
Multi-match query | Elasticsearch Guide [8.5]
query.bool.max_clause_count setting, which defaults to 4096 . For multi-match queries, the number of clauses is calculated as the number of fields ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found