Skip to content

Getting connection value outside of master/slave function #1

@gurinder-sason

Description

@gurinder-sason

Hi
i am using this npm for making mysql cluster, but i stuck at one place. Below code make connection inside slave function. I want to move connection outside this function so that no need to copy this code to execute query each time. currently getting undefined as it is called after the calback

cluster.slave(function(err, conn) {
if(!err) {
conn.query('select * from test limit 10', function(err, result, fields) {
// do something
conn.release(); // Put the connection back into pool.
}
} else {
console.log('Error, failed to aquire connection);
console.log(err);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions