MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clusterManagerExecTransaction

Function clusterManagerExecTransaction

src/redis-cli.c:2496–2523  ·  view source on GitHub ↗

Call EXEC command on a cluster node. */

Source from the content-addressed store, hash-verified

2494
2495/* Call EXEC command on a cluster node. */
2496static int clusterManagerExecTransaction(clusterManagerNode *node,
2497 clusterManagerOnReplyError onerror)
2498{
2499 redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "EXEC");
2500 int success = clusterManagerCheckRedisReply(node, reply, NULL);
2501 if (success) {
2502 if (reply->type != REDIS_REPLY_ARRAY) {
2503 success = 0;
2504 goto cleanup;
2505 }
2506 size_t i;
2507 for (i = 0; i < reply->elements; i++) {
2508 redisReply *r = reply->element[i];
2509 char *err = NULL;
2510 success = clusterManagerCheckRedisReply(node, r, &err);
2511 if (!success && onerror) success = onerror(r, node, i);
2512 if (err) {
2513 if (!success)
2514 CLUSTER_MANAGER_PRINT_REPLY_ERROR(node, err);
2515 zfree(err);
2516 }
2517 if (!success) break;
2518 }
2519 }
2520cleanup:
2521 if (reply) freeReplyObject(reply);
2522 return success;
2523}
2524
2525static int clusterManagerNodeConnect(clusterManagerNode *node) {
2526 if (node->context) redisFree(node->context);

Callers 1

Calls 3

zfreeFunction · 0.85
freeReplyObjectFunction · 0.85

Tested by

no test coverage detected