Skip to content

How to wait for outstanding queries to finish? #3426

Answered by simolus3
Mr-Pepe asked this question in Q&A
Discussion options

You must be logged in to vote

Waiting for in-flight request before closing the database sounds reasonable, but that's not technically what's happening here. The error you've posted is thrown here, before submitting requests

if (isClosed) {
throw StateError('Tried to send $msg over isolate channel, but the '
'connection was closed!');
}

For in-flight requests, you'd get a Channel was closed before receiving a response error.

This actually makes it kind of tricky to fix this issue in drift. You have one asynchronous task closing the database and other independent tasks not realizing that and continuing to emit stat…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Mr-Pepe
Comment options

Answer selected by Mr-Pepe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants