-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
Description
function reloadQuestion() {
var obj = {};
connection.connect();
connection.query("SELECT * FROM quiz", function (err, rows, fields) {
if (err) throw err;
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
obj = {"id":row.id, "question":row.question, "answers":row.answers.split(", ")};
f100.push(obj);
arr.push(i);
};
shuffleArray(arr);
newQuestion();
});
connection.end();
}
reloadQuestion();
its work fine, then when after a condition when try to call reloadQuestion
again its got error
Error: Cannot enqueue Handshake after already enqueuing a Handshake.
at Protocol._validateEnqueue (/home/bot/node_modules/mysql/lib/protocol/Protocol.js:202:16)
at Protocol._enqueue (/home/bot/node_modules/mysql/lib/protocol/Protocol.js:129:13)
at Protocol.handshake (/home/bot/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at Connection.connect (/home/bot/node_modules/mysql/lib/Connection.js:123:18)
at reloadQuestion (/home/bot/f100.js:56:13)
at null._onTimeout (/home/bot/f100.js:80:8)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
already try to remove connection.end();
but the problem still