MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / keepSocketAlive

Method keepSocketAlive

out/cli.cjs:9506–9527  ·  view source on GitHub ↗
(socket)

Source from the content-addressed store, hash-verified

9504 }
9505 }
9506 keepSocketAlive(socket) {
9507 const result = super.keepSocketAlive(socket);
9508 if (!result) return result;
9509 const customTimeout = this.calcSocketTimeout(socket);
9510 if (typeof customTimeout === "undefined") {
9511 return true;
9512 }
9513 if (customTimeout <= 0) {
9514 debug5(
9515 "%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",
9516 socket[SOCKET_NAME],
9517 socket[SOCKET_REQUEST_COUNT],
9518 socket[SOCKET_REQUEST_FINISHED_COUNT],
9519 customTimeout
9520 );
9521 return false;
9522 }
9523 if (socket.timeout !== customTimeout) {
9524 socket.setTimeout(customTimeout);
9525 }
9526 return true;
9527 }
9528 // only call on addRequest
9529 reuseSocket(...args) {
9530 super.reuseSocket(...args);

Callers

nothing calls this directly

Calls 3

debug5Function · 0.85
calcSocketTimeoutMethod · 0.80
setTimeoutMethod · 0.80

Tested by

no test coverage detected