MCPcopy
hub / github.com/benoitc/gunicorn / _execute_locked

Method _execute_locked

gunicorn/dirty/client.py:101–136  ·  view source on GitHub ↗

Execute while holding the lock.

(self, app_path, action, args, kwargs)

Source from the content-addressed store, hash-verified

99 return self._execute_locked(app_path, action, args, kwargs)
100
101 def _execute_locked(self, app_path, action, args, kwargs):
102 """Execute while holding the lock."""
103 # Ensure connected
104 if self._sock is None:
105 self.connect()
106
107 # Build request
108 request_id = str(uuid.uuid4())
109 request = make_request(
110 request_id=request_id,
111 app_path=app_path,
112 action=action,
113 args=args,
114 kwargs=kwargs
115 )
116
117 try:
118 # Send request
119 DirtyProtocol.write_message(self._sock, request)
120
121 # Receive response
122 response = DirtyProtocol.read_message(self._sock)
123
124 # Handle response
125 return self._handle_response(response)
126 except socket.timeout:
127 self._close_socket()
128 raise DirtyTimeoutError(
129 "Timeout waiting for dirty app response",
130 timeout=self.timeout
131 )
132 except Exception as e:
133 self._close_socket()
134 if isinstance(e, DirtyError):
135 raise
136 raise DirtyConnectionError(f"Communication error: {e}") from e
137
138 def stream(self, app_path, action, *args, **kwargs):
139 """

Callers 1

executeMethod · 0.95

Calls 8

connectMethod · 0.95
_handle_responseMethod · 0.95
_close_socketMethod · 0.95
DirtyTimeoutErrorClass · 0.85
make_requestFunction · 0.70
write_messageMethod · 0.45
read_messageMethod · 0.45

Tested by

no test coverage detected