I think you'd be better off using the State Processor API [1] instead. The State Processor API has cleaner semantics -- as you'll be seeing a self-consistent snapshot of all the state -- and it's also much more performant.
Note also that the Queryable State API is "approaching end of life" [2]. The long-term objective is to replace this with something more useful.
Regards,
Hi,
Is there any scalability concern for using state query in this way? Appreciate any insight. Thanks!