mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-09 20:21:01 +00:00
fix: Failsafe broadcast (#167)
This commit is contained in:
@@ -91,6 +91,8 @@ export default class Chain {
|
||||
}
|
||||
|
||||
public staleNode(node: Node) {
|
||||
node.isStale = true;
|
||||
|
||||
this.feeds.broadcast(Feed.staleNode(node));
|
||||
|
||||
if (this.height === node.best.number) {
|
||||
|
||||
@@ -50,6 +50,13 @@ export default class FeedSet {
|
||||
private sendMessages = () => {
|
||||
const data = FeedMessage.serialize(this.messages);
|
||||
this.messages = [];
|
||||
this.each(feed => feed.sendData(data));
|
||||
|
||||
this.each(feed => {
|
||||
try {
|
||||
feed.sendData(data);
|
||||
} catch (err) {
|
||||
console.error("Failed to broadcast to feed", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,6 @@ export default class Node {
|
||||
this.disconnect();
|
||||
} else {
|
||||
if (!this.isStale && this.blockTimestamp + NO_BLOCK_TIMEOUT < now) {
|
||||
this.isStale = true;
|
||||
this.events.emit('stale');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user