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

Function luaRedisReplicateCommandsCommand

src/scripting.cpp:928–940  ·  view source on GitHub ↗

redis.replicate_commands() * * Turn on single commands replication if the script never called * a write command so far, and returns true. Otherwise if the script * already started to write, returns false and stick to whole scripts * replication, which is our default. */

Source from the content-addressed store, hash-verified

926 * already started to write, returns false and stick to whole scripts
927 * replication, which is our default. */
928int luaRedisReplicateCommandsCommand(lua_State *lua) {
929 if (g_pserver->lua_write_dirty) {
930 lua_pushboolean(lua,0);
931 } else {
932 g_pserver->lua_replicate_commands = 1;
933 /* When we switch to single commands replication, we can provide
934 * different math.random() sequences at every call, which is what
935 * the user normally expects. */
936 redisSrand48(rand());
937 lua_pushboolean(lua,1);
938 }
939 return 1;
940}
941
942/* redis.breakpoint()
943 *

Callers

nothing calls this directly

Calls 2

lua_pushbooleanFunction · 0.85
redisSrand48Function · 0.85

Tested by

no test coverage detected