so I realized that my machine will OOM if I run (by mistake) a very large query with dadbod. Thanks to the linux OOM killer, my machine is only unresponsive for some number of seconds, but then (in the best case) neovim is killed, which is not ideal.
People should not make mistakes, but...
So this change introduces a configurable max number of rows to fetch before aborting a query to avoid such situations.
There is a least one little issue with this patch: if the limit is in fact reached, and rows come in fast, the warning "Query aborted..." can be written multiple times to the output before the writes do in fact stop.
UPDATE: made a followup force push that fixes the writing "query aborted" multiple times and also the case where the file would be truncated in the middle of a line.
so I realized that my machine will OOM if I run (by mistake) a very large query with dadbod. Thanks to the linux OOM killer, my machine is only unresponsive for some number of seconds, but then (in the best case) neovim is killed, which is not ideal. People should not make mistakes, but...
So this change introduces a configurable max number of rows to fetch before aborting a query to avoid such situations.
There is a least one little issue with this patch: if the limit is in fact reached, and rows come in fast, the warning "Query aborted..." can be written multiple times to the output before the writes do in fact stop.UPDATE: made a followup force push that fixes the writing "query aborted" multiple times and also the case where the file would be truncated in the middle of a line.