diff --git a/app/controllers/api/v1/sse.js b/app/controllers/api/v1/sse.js index 536190f..ea1419d 100644 --- a/app/controllers/api/v1/sse.js +++ b/app/controllers/api/v1/sse.js @@ -1,7 +1,3 @@ -const { conns } = require('../../../../helpers/bree-hooks'); - -let uuid = 0; - async function connect(ctx) { if (ctx.sse) { // likely not the best way to do this @@ -25,8 +21,6 @@ async function connect(ctx) { data: isActive(ctx) }); - conns.push({ id: uuid, sse: ctx.sse }); - // send bree events over sse for (const event of ['worker created', 'worker deleted']) { ctx.bree.on(event, (name) => { @@ -45,18 +39,8 @@ async function connect(ctx) { ctx.sse.on('close', () => { ctx.logger.error('SSE closed'); - // remove from conns array) - const idx = conns.findIndex((conn) => conn.id === uuid); - - if (idx > 0) { - conns.splice(idx, 1); - } - clearInterval(interval); }); - - // bump uuid - uuid++; } }