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

Function TimeEvent_Callback

plugins/python/redisgears_python.c:4382–4398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4380RedisModuleType *TimeEventType;
4381
4382static void TimeEvent_Callback(RedisModuleCtx *ctx, void *data){
4383 TimerData* td = data;
4384 PythonExecutionCtx pectx = PythonExecutionCtx_New(td->session, NULL);
4385 RedisGearsPy_Lock(&pectx);
4386 PyObject* pArgs = PyTuple_New(0);
4387 PyObject_CallObject(td->callback, pArgs);
4388 if(PyErr_Occurred()){
4389 char* error = getPyError();
4390 RedisModule_Log(staticCtx, "warning", "Error occured on TimeEvent_Callback, error=%s", error);
4391 RG_FREE(error);
4392 td->status =TE_STATUS_ERR;
4393 }else{
4394 td->id = RedisModule_CreateTimer(ctx, td->period * 1000, TimeEvent_Callback, td);
4395 }
4396 GearsPyDecRef(pArgs);
4397 RedisGearsPy_Unlock(&pectx);
4398}
4399
4400static void *TimeEvent_RDBLoad(RedisModuleIO *rdb, int encver){
4401 TimerData* td = RG_ALLOC(sizeof(*td));

Callers

nothing calls this directly

Calls 4

RedisGearsPy_LockFunction · 0.85
getPyErrorFunction · 0.85
GearsPyDecRefFunction · 0.85
RedisGearsPy_UnlockFunction · 0.85

Tested by

no test coverage detected