| 6430 | } |
| 6431 | |
| 6432 | static int RedisGearsPy_ProfileReset(RedisModuleCtx *ctx, RedisModuleString **argv, int argc){ |
| 6433 | if (argc != 1){ |
| 6434 | return RedisModule_WrongArity(ctx); |
| 6435 | } |
| 6436 | |
| 6437 | const char* strId = RedisModule_StringPtrLen(argv[0], NULL); |
| 6438 | |
| 6439 | PythonSessionCtx* s = PythonSessionCtx_Get(strId); |
| 6440 | if (!s) { |
| 6441 | RedisModule_ReplyWithError(ctx, "session does not exists"); |
| 6442 | return REDISMODULE_OK; |
| 6443 | } |
| 6444 | |
| 6445 | PythonExecutionCtx pectx = PythonExecutionCtx_New(s, NULL); |
| 6446 | RedisGearsPy_Lock(&pectx); |
| 6447 | GearsPyDecRef(s->profiler); |
| 6448 | s->profiler = PyObject_CallFunction(profileCreateFunction, NULL); |
| 6449 | RedisGearsPy_Unlock(&pectx); |
| 6450 | PythonSessionCtx_Free(s); |
| 6451 | RedisModule_ReplyWithSimpleString(ctx, "OK"); |
| 6452 | return REDISMODULE_OK; |
| 6453 | } |
| 6454 | |
| 6455 | static int RedisGearsPy_ProfileStats(RedisModuleCtx *ctx, RedisModuleString **argv, int argc){ |
| 6456 | if (argc < 0 || argc > 2){ |
no test coverage detected