Skip to content

Commit

Permalink
Address some of the format suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: KarthikSubbarao <[email protected]>
  • Loading branch information
KarthikSubbarao committed Jul 1, 2024
1 parent 676d87c commit d054ab1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) {
* custom LUA errors, we track the error under `error_LUA` */
if (flags & ERR_REPLY_FLAG_LUA && raxSize(server.errors) >= ERROR_STATS_LUA_LIMIT) {
incrementErrorCount(LUA_ERRORSTATS_OVERFLOW_ERR, strlen(LUA_ERRORSTATS_OVERFLOW_ERR));
/* If the string already starts with "-..." then the error prefix
* is provided by the caller ( we limit the search to 32 chars). Otherwise we use "-ERR". */
} else if (s[0] != '-') {
/* If the string already starts with "-..." then the error prefix
* is provided by the caller ( we limit the search to 32 chars). Otherwise we use "-ERR". */
incrementErrorCount("ERR", 3);
} else {
char *spaceloc = memchr(s, ' ', len < 32 ? len : 32);
Expand Down
7 changes: 3 additions & 4 deletions src/script_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,9 @@ static void luaReplyToRedisReply(client *c, client *script_client, lua_State *lu
1); /* pop the error message, we will use luaExtractErrorInformation to get error information */
errorInfo err_info = {0};
luaExtractErrorInformation(lua, &err_info);
addReplyErrorFormatEx(c,
ERR_REPLY_FLAG_LUA | (err_info.ignore_err_stats_update? ERR_REPLY_FLAG_NO_STATS_UPDATE: 0),
"-%s",
err_info.msg);
addReplyErrorFormatEx(
c, ERR_REPLY_FLAG_LUA | (err_info.ignore_err_stats_update ? ERR_REPLY_FLAG_NO_STATS_UPDATE : 0), "-%s",
err_info.msg);
luaErrorInformationDiscard(&err_info);
lua_pop(lua, 1); /* pop the result table */
return;
Expand Down
2 changes: 1 addition & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -4048,7 +4048,7 @@ int processCommand(client *c) {

void incrementErrorCount(const char *fullerr, size_t namelen) {
void *result;
if (!raxFind(server.errors,(unsigned char*)fullerr,namelen,&result)) {
if (!raxFind(server.errors, (unsigned char *)fullerr, namelen, &result)) {
struct serverError *error = zmalloc(sizeof(*error));
error->count = 1;
raxInsert(server.errors, (unsigned char *)fullerr, namelen, error, NULL);
Expand Down
4 changes: 2 additions & 2 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1579,8 +1579,8 @@ struct valkeyServer {
dict *commands; /* Command table */
dict *orig_commands; /* Command table before command renaming. */
aeEventLoop *el;
rax *errors; /* Errors table */
unsigned int lruclock; /* Clock for LRU eviction */
rax *errors; /* Errors table */
unsigned int lruclock; /* Clock for LRU eviction */
volatile sig_atomic_t shutdown_asap; /* Shutdown ordered by signal handler. */
mstime_t shutdown_mstime; /* Timestamp to limit graceful shutdown. */
int last_sig_received; /* Indicates the last SIGNAL received, if any (e.g., SIGINT or SIGTERM). */
Expand Down

0 comments on commit d054ab1

Please sign in to comment.