Node.js 在express app中批量发送服务器响应

Node.js 在express app中批量发送服务器响应,node.js,oracle,express,Node.js,Oracle,Express,我正在将我的应用程序的oracledb驱动程序与此库结合使用 我希望以批量方式发送查询结果,但我不断收到错误: 错误:发送邮件后无法设置邮件头 这是我的密码: router.get('/', function (req,res) { "use strict"; oracledb.getConnection(connAttrs.database, function (err, connection) { if (err) { // Error connecting to

我正在将我的应用程序的oracledb驱动程序与此库结合使用

我希望以批量方式发送查询结果,但我不断收到错误:

错误:发送邮件后无法设置邮件头

这是我的密码:

router.get('/', function (req,res) {
"use strict"; 

oracledb.getConnection(connAttrs.database, function (err, connection) {
    if (err) {
        // Error connecting to DB
        res.set('Content-Type', 'application/json');
        res.status(500).send(JSON.stringify({
            status: 500,
            message: "Error connecting to DB",
            detailed_message: err.message
        }));
        return;
    }
    connection.query("Select * from solvedtasks",{},{
        splitResults: true, //True to enable to split the results into bulks, each bulk will invoke the provided callback (last callback invocation will have empty results)
        bulkRowsAmount: 1000 //The amount of rows to fetch (for splitting results, that is the max rows that the callback will get for each callback invocation)
    },
        function onResults (err, results) {
            if (err) {
                res.set('Content-Type', 'application/json');
                res.status(500).send(JSON.stringify({
                    status: 500,
                    message: "Error getting the user profile",
                    detailed_message: err.message
                }));
            } else if(results.length)
            {
                res.send(results);
            }
            else {
                // Release the connection
                console.log("done");
                connection.release(
                    function (err) {
                        if (err) {
                            console.error(err.message);
                        } else {
                            console.log("GET /SolvedTasks : Connection released");
                        }
                    });
            }
        });
});
});
这种错误的发生显然是因为它多次执行res.send(results)。我只得到前1000行,然后错误就发生了。你知道如何解决这个问题吗?继续大量发送结果,但不获取错误