Skip to content

Commit

Permalink
fix(sse): remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowgate15 committed Aug 2, 2022
1 parent fcdb64e commit 5d24895
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions app/controllers/api/v1/sse.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) => {
Expand All @@ -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++;
}
}

Expand Down

0 comments on commit 5d24895

Please sign in to comment.