MCPcopy
hub / github.com/socketio/socket.io / _acquireLock

Function _acquireLock

packages/socket.io-cluster-engine/lib/engine.ts:433–463  ·  packages/socket.io-cluster-engine/lib/engine.ts::_acquireLock
(
    sid: SessionId,
    transportName: string,
    lockType: "read" | "write",
    onSuccess: (senderId: NodeId) => void,
    onError: () => void,
  )

Source from the content-addressed store, hash-verified

431 }
432
433 private _acquireLock(
434 sid: SessionId,
435 transportName: string,
436 lockType: class="st">"read" | class="st">"write",
437 onSuccess: (senderId: NodeId) => void,
438 onError: () => void,
439 ) {
440 const requestId = ++this._requestCount as RequestId;
441
442 const timer = setTimeout(() => {
443 this._requests.delete(requestId);
444 onError();
445 }, this._opts.responseTimeout);
446
447 this._requests.set(requestId, {
448 timer,
449 onSuccess,
450 onError,
451 });
452
453 this.publishMessage({
454 requestId,
455 senderId: this._nodeId,
456 type: MessageType.ACQUIRE_LOCK,
457 data: {
458 sid,
459 transportName,
460 type: lockType,
461 },
462 });
463 }
464
465 private _hookTransport(
466 sid: SessionId,

Callers

nothing calls this directly

Calls 2

onErrorFunction · 0.70
publishMessageMethod · 0.45

Tested by

no test coverage detected