You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 27, 2019. It is now read-only.
Considering the first utility (that yields the first result and then breaks):
import{fist}from'axax/esnext/first'asyncfunction*toAsyncIterable(conn,config){conststream=conn.query(newQueryStream(config.text,config.values))returnyield*stream// It's ok, stream.Readable has an [Symbol.asyncIterator] method}awaitfirst(toAsyncIterable(conn,'SELECT * FROM some_table_with_more_than_one_entry'))
Doing so will result in the connection being stuck because the cursor was never closed.
My current workaround:
import{fist}from'axax/esnext/first'asyncfunctionqueryStream(conn,config){conststream=conn.query(newQueryStream(config.text,config.values))try{returnyield*stream}finally{// This will be called when iterator.return() is calledstream.close()}}awaitfirst(toAsyncIterable(conn,'SELECT * FROM some_table_with_more_than_one_entry'))
I believe that internally, node will wall the "destroy" method of the stream once the iterator consumer stops requesting output.
The text was updated successfully, but these errors were encountered:
Considering the first utility (that yields the first result and then breaks):
Doing so will result in the connection being stuck because the cursor was never closed.
My current workaround:
I believe that internally, node will wall the "destroy" method of the stream once the iterator consumer stops requesting output.
The text was updated successfully, but these errors were encountered: