diff --git a/api/src/controllers/databaseConnections.js b/api/src/controllers/databaseConnections.js index 6f310efd5..2d3d6e217 100644 --- a/api/src/controllers/databaseConnections.js +++ b/api/src/controllers/databaseConnections.js @@ -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; }, diff --git a/api/src/proc/databaseConnectionProcess.js b/api/src/proc/databaseConnectionProcess.js index a2f93dee7..0f28e47cb 100644 --- a/api/src/proc/databaseConnectionProcess.js +++ b/api/src/proc/databaseConnectionProcess.js @@ -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 => {