MCPcopy Create free account
hub / github.com/agentrpc/agentrpc / runLoop

Method runLoop

sdk-node/src/polling.ts:62–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 }
61
62 private async runLoop() {
63 this.polling = true;
64
65 let failureCount = 0;
66
67 while (this.polling) {
68 try {
69 await this.pollIteration();
70 if (failureCount > 0) {
71 log(`Poll iteration recovered after ${failureCount} failures`);
72 failureCount = 0;
73 }
74 } catch (e) {
75 log("Failed poll iteration", {
76 failureCount,
77 error: e,
78 });
79
80 failureCount++;
81 }
82
83 await new Promise((resolve) =>
84 setTimeout(resolve, this.retryAfter * 1000),
85 );
86 }
87 }
88
89 private async pollIteration() {
90 if (!this.clusterId) {

Callers 1

startMethod · 0.95

Calls 1

pollIterationMethod · 0.95

Tested by

no test coverage detected