Skip to content

Commit

Permalink
Make popMsgWithPredicateObeyPriority() check if hash exists
Browse files Browse the repository at this point in the history
In some weird cases, we find the message in the queue but without a
payload in the hashmap. Although this is never expected, it seems to
happen, and this patch should stop the bleeding until we find out the
root cause.
  • Loading branch information
smukil committed Jan 21, 2020
1 parent ee40066 commit 3da0ec1
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -859,12 +859,14 @@ private Message popMsgWithPredicateObeyPriority(String predicate, boolean localS
" num_complete_shards = num_complete_shards + 1\n" +
" else\n" +
" local value = redis.call('hget', hkey, tostring(element[1]))\n" +
" if (string.match(value, predicate)) then\n" +
" if (min_score == -1 or tonumber(element[2]) < min_score) then\n" +
" min_score = tonumber(element[2])\n" +
" owning_shard_idx=i\n" +
" min_member = element[1]\n" +
" matching_value = value\n" +
" if (value) then\n" +
" if (string.match(value, predicate)) then\n" +
" if (min_score == -1 or tonumber(element[2]) < min_score) then\n" +
" min_score = tonumber(element[2])\n" +
" owning_shard_idx=i\n" +
" min_member = element[1]\n" +
" matching_value = value\n" +
" end\n" +
" end\n" +
" end\n" +
" end\n" +
Expand Down

0 comments on commit 3da0ec1

Please sign in to comment.