@isoloop/bus 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bus-worker.js +9 -0
- package/package.json +3 -3
package/dist/bus-worker.js
CHANGED
|
@@ -1276,6 +1276,7 @@ var Broker = class {
|
|
|
1276
1276
|
grants,
|
|
1277
1277
|
port,
|
|
1278
1278
|
subs: /* @__PURE__ */ new Map(),
|
|
1279
|
+
warned: /* @__PURE__ */ new Set(),
|
|
1279
1280
|
reset: opts.reattach ? /* @__PURE__ */ new Set() : void 0
|
|
1280
1281
|
};
|
|
1281
1282
|
this.#conns.set(isolateId, conn);
|
|
@@ -1338,6 +1339,7 @@ var Broker = class {
|
|
|
1338
1339
|
close: () => {}
|
|
1339
1340
|
},
|
|
1340
1341
|
subs: /* @__PURE__ */ new Map(),
|
|
1342
|
+
warned: /* @__PURE__ */ new Set(),
|
|
1341
1343
|
reset: void 0,
|
|
1342
1344
|
host: true
|
|
1343
1345
|
},
|
|
@@ -1406,6 +1408,7 @@ var Broker = class {
|
|
|
1406
1408
|
this.#reply(conn, msg.p.topic, msg.p.offset, msg.p.value, reply);
|
|
1407
1409
|
return;
|
|
1408
1410
|
case "subscribe": {
|
|
1411
|
+
if (this.#dev) this.#warnRepeatSubscribe(conn, msg.p.topic);
|
|
1409
1412
|
const held = this.#topics.get(msg.p.topic)?.seeding;
|
|
1410
1413
|
if (held && (isSystemTopic(msg.p.topic) || matchAny(conn.grants.subscribe, msg.p.topic))) {
|
|
1411
1414
|
held.push({
|
|
@@ -1766,6 +1769,12 @@ var Broker = class {
|
|
|
1766
1769
|
p: r
|
|
1767
1770
|
});
|
|
1768
1771
|
}
|
|
1772
|
+
#warnRepeatSubscribe(conn, topic) {
|
|
1773
|
+
if (conn.warned.has(topic)) return;
|
|
1774
|
+
if (!(this.#topics.get(topic)?.seeding?.some((h) => h.conn === conn) ?? false) && !conn.subs.has(topic)) return;
|
|
1775
|
+
conn.warned.add(topic);
|
|
1776
|
+
console.warn(`[isoloop] isolate "${conn.isolateId}" subscribed to "${topic}" again; the newer subscription replaced the older one (a second useTopic or bus.subscribe on this topic).`);
|
|
1777
|
+
}
|
|
1769
1778
|
#subscribe(conn, name, from, group) {
|
|
1770
1779
|
if (!isStartPosition(from)) return fail("invalid", "from must be latest, earliest or committed");
|
|
1771
1780
|
if (group !== void 0 && (typeof group !== "string" || group === "")) return fail("invalid", "group must be a non-empty string");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isoloop/bus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The Isoloop message bus: typed topics in a worker, with retention, replay and durable history.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isoloop",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@isoloop/codec": "0.1.
|
|
45
|
-
"@isoloop/protocol": "0.1.
|
|
44
|
+
"@isoloop/codec": "0.1.1",
|
|
45
|
+
"@isoloop/protocol": "0.1.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"fast-check": "4.10.2",
|