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

Method encode_manage

gunicorn/dirty/protocol.py:304–323  ·  view source on GitHub ↗

Encode a worker management message. Args: request_id: Request identifier op: Management operation (MANAGE_OP_ADD or MANAGE_OP_REMOVE) count: Number of workers to add/remove Returns: bytes: Complete message (header + payload)

(request_id: int, op: int, count: int = 1)

Source from the content-addressed store, hash-verified

302
303 @staticmethod
304 def encode_manage(request_id: int, op: int, count: int = 1) -> bytes:
305 """
306 Encode a worker management message.
307
308 Args:
309 request_id: Request identifier
310 op: Management operation (MANAGE_OP_ADD or MANAGE_OP_REMOVE)
311 count: Number of workers to add/remove
312
313 Returns:
314 bytes: Complete message (header + payload)
315 """
316 payload_dict = {
317 "op": op,
318 "count": count,
319 }
320 payload = TLVEncoder.encode(payload_dict)
321 header = BinaryProtocol.encode_header(MSG_TYPE_MANAGE, request_id,
322 len(payload))
323 return header + payload
324
325 @staticmethod
326 def encode_stash(request_id: int, op: int, table: str,

Callers 1

_encode_from_dictMethod · 0.80

Calls 2

encodeMethod · 0.80
encode_headerMethod · 0.80

Tested by

no test coverage detected