mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:18:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -81,11 +81,15 @@ export class NodeRegistry {
|
||||
|
||||
unregister(connId: string): string | null {
|
||||
const nodeId = this.nodesByConn.get(connId);
|
||||
if (!nodeId) return null;
|
||||
if (!nodeId) {
|
||||
return null;
|
||||
}
|
||||
this.nodesByConn.delete(connId);
|
||||
this.nodesById.delete(nodeId);
|
||||
for (const [id, pending] of this.pendingInvokes.entries()) {
|
||||
if (pending.nodeId !== nodeId) continue;
|
||||
if (pending.nodeId !== nodeId) {
|
||||
continue;
|
||||
}
|
||||
clearTimeout(pending.timer);
|
||||
pending.reject(new Error(`node disconnected (${pending.command})`));
|
||||
this.pendingInvokes.delete(id);
|
||||
@@ -160,8 +164,12 @@ export class NodeRegistry {
|
||||
error?: { code?: string; message?: string } | null;
|
||||
}): boolean {
|
||||
const pending = this.pendingInvokes.get(params.id);
|
||||
if (!pending) return false;
|
||||
if (pending.nodeId !== params.nodeId) return false;
|
||||
if (!pending) {
|
||||
return false;
|
||||
}
|
||||
if (pending.nodeId !== params.nodeId) {
|
||||
return false;
|
||||
}
|
||||
clearTimeout(pending.timer);
|
||||
this.pendingInvokes.delete(params.id);
|
||||
pending.resolve({
|
||||
@@ -175,7 +183,9 @@ export class NodeRegistry {
|
||||
|
||||
sendEvent(nodeId: string, event: string, payload?: unknown): boolean {
|
||||
const node = this.nodesById.get(nodeId);
|
||||
if (!node) return false;
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
return this.sendEventToSession(node, event, payload);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user