mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
database connection fix
This commit is contained in:
@@ -35,7 +35,7 @@ module.exports = {
|
||||
subprocess.on('message', ({ msgtype, ...message }) => {
|
||||
this[`handle_${msgtype}`](id, database, message);
|
||||
});
|
||||
subprocess.send({ msgtype: 'connect', ...connection });
|
||||
subprocess.send({ msgtype: 'connect', ...connection, database });
|
||||
return newOpened;
|
||||
},
|
||||
|
||||
|
||||
@@ -6,15 +6,14 @@ let storedConnection;
|
||||
async function handleFullRefresh() {
|
||||
const driver = engines(storedConnection);
|
||||
const structure = await driver.analyseFull(systemConnection);
|
||||
console.log('SENDING STRUCTURE', structure);
|
||||
process.send({ msgtype: 'structure', structure });
|
||||
}
|
||||
|
||||
async function handleConnect(connection, database) {
|
||||
async function handleConnect(connection) {
|
||||
storedConnection = connection;
|
||||
|
||||
const driver = engines(storedConnection);
|
||||
systemConnection = await driver.connect({ ...storedConnection, database });
|
||||
systemConnection = await driver.connect(storedConnection);
|
||||
handleFullRefresh();
|
||||
setInterval(handleFullRefresh, 30 * 1000);
|
||||
}
|
||||
@@ -23,9 +22,9 @@ const messageHandlers = {
|
||||
connect: handleConnect,
|
||||
};
|
||||
|
||||
async function handleMessage({ msgtype, database, ...other }) {
|
||||
async function handleMessage({ msgtype, ...other }) {
|
||||
const handler = messageHandlers[msgtype];
|
||||
await handler(other, database);
|
||||
await handler(other);
|
||||
}
|
||||
|
||||
process.on('message', async message => {
|
||||
|
||||
Reference in New Issue
Block a user