Skip to content

Commit 2bb62bf

Browse files
committed
support event rounting
1 parent 7c36125 commit 2bb62bf

File tree

3 files changed

+171
-5
lines changed

3 files changed

+171
-5
lines changed

nohup.out

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,3 +4356,169 @@ watching ./src
43564356
watching ./src
43574357
change services/service-mesh/nats-mesh.js
43584358
change services/service-mesh/nats-mesh.js
4359+
change services/service-mesh/nats-mesh.js
4360+
change services/service-mesh/nats-mesh.js
4361+
change services/service-mesh/web-switch/switch.js
4362+
change services/service-mesh/web-switch/switch.js
4363+
change domain/event-router.js
4364+
change domain/event-router.js
4365+
Error: Command failed: ./watch.sh 80 8888
4366+
Error: ENOENT: no such file or directory, lstat 'esm//adapters/cli/index.js'
4367+
at Object.lstatSync (node:fs:1561:3)
4368+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:146:17
4369+
at Array.forEach (<anonymous>)
4370+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4371+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4372+
at Array.forEach (<anonymous>)
4373+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4374+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4375+
at Array.forEach (<anonymous>)
4376+
at Object.deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29) {
4377+
errno: -2,
4378+
syscall: 'lstat',
4379+
code: 'ENOENT',
4380+
path: 'esm//adapters/cli/index.js'
4381+
}
4382+
error Command failed with exit code 1.
4383+
4384+
at ChildProcess.exithandler (node:child_process:402:12)
4385+
at ChildProcess.emit (node:events:513:28)
4386+
at maybeClose (node:internal/child_process:1100:16)
4387+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4388+
code: 7,
4389+
killed: false,
4390+
signal: null,
4391+
cmd: './watch.sh 80 8888'
4392+
}
4393+
Error: Command failed: ./watch.sh 80 8888
4394+
4395+
at ChildProcess.exithandler (node:child_process:402:12)
4396+
at ChildProcess.emit (node:events:513:28)
4397+
at maybeClose (node:internal/child_process:1100:16)
4398+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4399+
code: 7,
4400+
killed: false,
4401+
signal: null,
4402+
cmd: './watch.sh 80 8888'
4403+
}
4404+
Error: Command failed: ./watch.sh 80 8888
4405+
4406+
at ChildProcess.exithandler (node:child_process:402:12)
4407+
at ChildProcess.emit (node:events:513:28)
4408+
at maybeClose (node:internal/child_process:1100:16)
4409+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4410+
code: 7,
4411+
killed: false,
4412+
signal: null,
4413+
cmd: './watch.sh 80 8888'
4414+
}
4415+
Error: Command failed: ./watch.sh 80 8888
4416+
4417+
at ChildProcess.exithandler (node:child_process:402:12)
4418+
at ChildProcess.emit (node:events:513:28)
4419+
at maybeClose (node:internal/child_process:1100:16)
4420+
at Socket.<anonymous> (node:internal/child_process:458:11)
4421+
at Socket.emit (node:events:513:28)
4422+
at Pipe.<anonymous> (node:net:301:12) {
4423+
code: 7,
4424+
killed: false,
4425+
signal: null,
4426+
cmd: './watch.sh 80 8888'
4427+
}
4428+
Error: Command failed: ./watch.sh 80 8888
4429+
Error: ENOENT: no such file or directory, lstat 'esm//adapters/cli/index.js'
4430+
at Object.lstatSync (node:fs:1561:3)
4431+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:146:17
4432+
at Array.forEach (<anonymous>)
4433+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4434+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4435+
at Array.forEach (<anonymous>)
4436+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4437+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4438+
at Array.forEach (<anonymous>)
4439+
at Object.deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29) {
4440+
errno: -2,
4441+
syscall: 'lstat',
4442+
code: 'ENOENT',
4443+
path: 'esm//adapters/cli/index.js'
4444+
}
4445+
error Command failed with exit code 1.
4446+
4447+
at ChildProcess.exithandler (node:child_process:402:12)
4448+
at ChildProcess.emit (node:events:513:28)
4449+
at maybeClose (node:internal/child_process:1100:16)
4450+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4451+
code: 7,
4452+
killed: false,
4453+
signal: null,
4454+
cmd: './watch.sh 80 8888'
4455+
}
4456+
Error: Command failed: ./watch.sh 80 8888
4457+
Error: ENOENT: no such file or directory, lstat 'esm//adapters/cli/index.js'
4458+
at Object.lstatSync (node:fs:1561:3)
4459+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:146:17
4460+
at Array.forEach (<anonymous>)
4461+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4462+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4463+
at Array.forEach (<anonymous>)
4464+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4465+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4466+
at Array.forEach (<anonymous>)
4467+
at Object.deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29) {
4468+
errno: -2,
4469+
syscall: 'lstat',
4470+
code: 'ENOENT',
4471+
path: 'esm//adapters/cli/index.js'
4472+
}
4473+
error Command failed with exit code 1.
4474+
4475+
at ChildProcess.exithandler (node:child_process:402:12)
4476+
at ChildProcess.emit (node:events:513:28)
4477+
at maybeClose (node:internal/child_process:1100:16)
4478+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4479+
code: 7,
4480+
killed: false,
4481+
signal: null,
4482+
cmd: './watch.sh 80 8888'
4483+
}
4484+
Error: Command failed: ./watch.sh 80 8888
4485+
Error: ENOENT: no such file or directory, lstat 'esm//adapters/cli/index.js'
4486+
at Object.lstatSync (node:fs:1561:3)
4487+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:146:17
4488+
at Array.forEach (<anonymous>)
4489+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4490+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4491+
at Array.forEach (<anonymous>)
4492+
at deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29)
4493+
at /Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:147:9
4494+
at Array.forEach (<anonymous>)
4495+
at Object.deleteDir (/Users/tysonmidboe/Code/aegis/node_modules/@babel/cli/lib/babel/util.js:143:29) {
4496+
errno: -2,
4497+
syscall: 'lstat',
4498+
code: 'ENOENT',
4499+
path: 'esm//adapters/cli/index.js'
4500+
}
4501+
error Command failed with exit code 1.
4502+
4503+
at ChildProcess.exithandler (node:child_process:402:12)
4504+
at ChildProcess.emit (node:events:513:28)
4505+
at maybeClose (node:internal/child_process:1100:16)
4506+
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
4507+
code: 7,
4508+
killed: false,
4509+
signal: null,
4510+
cmd: './watch.sh 80 8888'
4511+
}
4512+
Error: Command failed: ./watch.sh 80 8888
4513+
4514+
at ChildProcess.exithandler (node:child_process:402:12)
4515+
at ChildProcess.emit (node:events:513:28)
4516+
at maybeClose (node:internal/child_process:1100:16)
4517+
at Socket.<anonymous> (node:internal/child_process:458:11)
4518+
at Socket.emit (node:events:513:28)
4519+
at Pipe.<anonymous> (node:net:301:12) {
4520+
code: 7,
4521+
killed: false,
4522+
signal: null,
4523+
cmd: './watch.sh 80 8888'
4524+
}

src/domain/event-router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class PortEventRouter {
1616

1717
get threadLocalPorts () {
1818
if (this.__threadLocalPorts) return this.__threadLocalPorts
19-
this.__threadLocalPorts = this.__threadLocalPorts = this.models
19+
this.__threadLocalPorts = this.models
2020
.getModelSpecs()
2121
.filter(
2222
spec =>

src/services/service-mesh/web-switch/switch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function attachServer (httpServer, secureCtx = {}) {
186186
// tell client if its now a backup switch or not
187187
sendMesh(encode(client[info]), client)
188188
// tell everyone about new node (ignore browsers)
189-
if (client[info].role === 'node') broadcast(encode(statusReport()), client)
189+
if (client[info].role === 'node') sendMesh(encode(statusReport()), client)
190190
}
191191

192192
function handleEvent (client, message) {
@@ -224,7 +224,7 @@ export function attachServer (httpServer, secureCtx = {}) {
224224
return cli
225225
}
226226

227-
const noMatch = { sendMesh: msg => console.log('no match', msg) }
227+
const defRoute = { sendMesh: msg => console.log('no match', msg) }
228228

229229
WebSocket.prototype.sendMesh = function (message) {
230230
sendMesh.apply(this, message)
@@ -245,7 +245,7 @@ export function attachServer (httpServer, secureCtx = {}) {
245245
client !== sender &&
246246
client[info].services.includes(message.eventTarget)
247247
)
248-
.reduce(leastRecentlyUsed, noMatch)
248+
.reduce(leastRecentlyUsed, defRoute)
249249
.sendMesh(message),
250250
/**
251251
* Send to all clients running the service specified by `eventTarget`.
@@ -270,7 +270,7 @@ export function attachServer (httpServer, secureCtx = {}) {
270270
client =>
271271
client !== sender && client[info].events.includes(message.eventName)
272272
)
273-
.reduce(leastRecentlyUsed, noMatch)
273+
.reduce(leastRecentlyUsed, defRoute)
274274
.sendMesh(message),
275275
/**
276276
* Send to all clients that consume the event in `message.eventName`.

0 commit comments

Comments
 (0)