How do I cancel / abort a Cassandra request?

In NodeJS Cassandra code, handling callbacks for each line from client.stream()

or client.eachRow()

what's the correct way to stop the iteration? How do I tell the client object that I am no longer interested in the results. It might even be worth raising the "error" or "done" event.

Also would there be a problem with nodejs-driver if, while processing a string in an asynchronous way, the code triggers another request using the same client object?

+3


source to share


1 answer


With client.stream

you are working with stream.Readable so that you can call pause () on the stream, however, the driver will continue to process and buffer the data and pull in new pages as it comes in (assuming auto-loading is enabled).

When using client.stream

and, client.eachRow

you can provide an autoPage option to determine if the driver is paging when it hits the end of the page. If you are concerned about reading too much data from a large result set, you can use the pageState of the previous query for the next query (example here ). Unfortunately this doesn't work for client.stream

yet ( NODEJS-145 ).



Also would there be a problem with nodejs-driver if, while processing a string in an asynchronous way, the code triggers another request using the same client object?

It won't be a problem :)

+3


source







All Articles