MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / overrideReply

Function overrideReply

plugins/python/redisgears_python.c:4590–4623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4588}
4589
4590static PyObject* overrideReply(PyObject *cls, PyObject *args){
4591 PythonThreadCtx* ptctx = GetPythonThreadCtx();
4592
4593 CommandCtx* commandCtx = getCommandCtx(ptctx);
4594 if(!commandCtx){
4595 PyErr_SetString(GearsError, "Can not get command ctx");
4596 return NULL;
4597 }
4598
4599 if(PyTuple_Size(args) != 1){
4600 PyErr_SetString(GearsError, "Override reply must get a single argument");
4601 return NULL;
4602 }
4603
4604 PyObject* reply = PyTuple_GetItem(args, 0);
4605
4606 PythonRecord* record = (PythonRecord*)PyObjRecordCreate();
4607 record->obj = reply;
4608
4609 Py_INCREF(record->obj);
4610
4611 char* err = NULL;
4612
4613 if(RedisGears_CommandCtxOverrideReply(commandCtx, &record->base, &err) != REDISMODULE_OK){
4614 PyErr_SetString(GearsError, err);
4615 RG_FREE(err);
4616 RedisGears_FreeRecord(&record->base);
4617 return NULL;
4618 }
4619
4620 Py_INCREF(Py_None);
4621
4622 return Py_None;
4623}
4624
4625static PyObject* getCommand(PyObject *cls, PyObject *args){
4626 PythonThreadCtx* ptctx = GetPythonThreadCtx();

Callers

nothing calls this directly

Calls 3

GetPythonThreadCtxFunction · 0.85
getCommandCtxFunction · 0.85
PyObjRecordCreateFunction · 0.85

Tested by

no test coverage detected