-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve code style and do some minor fix in scripting #1312
Conversation
if (read_only) { | ||
/* redis.read_only */ | ||
lua_pushstring(lua, "read_only"); | ||
lua_pushboolean(lua, 1); | ||
lua_settable(lua, -3); | ||
} | ||
/* redis.read_only */ | ||
lua_pushstring(lua, "read_only"); | ||
lua_pushboolean(lua, read_only); | ||
lua_settable(lua, -3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not intuitionistic if the boolean value only exists when read_only is true
if (level < GetServer()->GetConfig()->log_level) { | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This level cannot be compared with loglevel in config.
src/storage/scripting.cc
Outdated
auto redisCmd = cmd_iter->second; | ||
if (read_only && redisCmd->is_write()) { | ||
if (read_only && ~(redisCmd->flags & Redis::kCmdReadOnly)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no assumption that a command is read-only if it has no write flag
std::string sha; | ||
auto s = createFunction(srv, body, &sha, lua); | ||
auto s = createFunction(srv, body, &sha, lua, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need to store the script body here.
Related to almost all functions in scripting.