Skip to content

Commit

Permalink
fix(rstream): update PubSub.subscribeTopic(), fix #248
Browse files Browse the repository at this point in the history
- use CloseMode.NEVER for internal topic subs
  • Loading branch information
postspectacular committed Sep 7, 2020
1 parent de6616c commit 3e2240a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/rstream/src/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import type { Fn, Predicate2 } from "@thi.ng/api";
import { EquivMap } from "@thi.ng/associative";
import { unsupported } from "@thi.ng/errors";
import type { Transducer } from "@thi.ng/transducers";
import { CommonOpts, ISubscriber, LOGGER, SubscriptionOpts } from "./api";
import {
CloseMode,
CommonOpts,
ISubscriber,
LOGGER,
SubscriptionOpts,
} from "./api";
import { Subscription, subscription } from "./subscription";
import { optsWithID } from "./utils/idgen";

Expand Down Expand Up @@ -110,7 +116,13 @@ export class PubSub<A, B> extends Subscription<A, B> {
opts?: Partial<CommonOpts>
): Subscription<any, any> {
let t = this.topics.get(topicID);
!t && this.topics.set(topicID, (t = subscription<B, B>()));
!t &&
this.topics.set(
topicID,
(t = subscription<B, B>(undefined, {
closeOut: CloseMode.NEVER,
}))
);
return t.subscribe(sub, opts);
}

Expand Down

0 comments on commit 3e2240a

Please sign in to comment.