Skip to content

Commit d01bfe0

Browse files
committed
Use subof to find first sub instance
1 parent 75af980 commit d01bfe0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

subsystems/sidecar/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,12 @@ class Sidecar extends ReadyResource {
366366
this.startId = startId
367367
this.clients = new Set()
368368
const opts = { retain: true }
369-
const reporter = this.sidecar.bus.sub(
370-
{ topic: 'reports', id: this.startId },
371-
opts
372-
)
373-
const warming = this.sidecar.bus.sub(
374-
{ topic: 'warming', id: this.startId },
375-
opts
376-
)
369+
const reporter =
370+
this.sidecar.bus.subof({ topic: 'reports', id: this.startId }) ??
371+
this.sidecar.bus.sub({ topic: 'reports', id: this.startId }, opts)
372+
const warming =
373+
this.sidecar.bus.subof({ topic: 'warming', id: this.startId }) ??
374+
this.sidecar.bus.sub({ topic: 'warming', id: this.startId }, opts)
377375
const updates = this.messages({ type: 'pear/updates' }, opts)
378376
this.cutover = (params) => {
379377
// closure scoped to keep cutover refs to top ancestor subs

0 commit comments

Comments
 (0)