@@ -34,13 +34,6 @@ ConsumerStateTable::ConsumerStateTable(DBConnector *db, const std::string &table
34
34
" redis.call('PUBLISH', KEYS[1], ARGV[1])\n "
35
35
" end\n " ;
36
36
m_multiPublish = loadRedisScript (m_db, luaMultiPublish);
37
-
38
- std::string luaScardPublish =
39
- " local num = redis.call('SCARD', KEYS[2])\n "
40
- " if num > 0 then\n "
41
- " redis.call('PUBLISH', KEYS[1], ARGV[1])\n "
42
- " end\n " ;
43
- m_scardPublish = loadRedisScript (m_db, luaScardPublish);
44
37
}
45
38
46
39
void ConsumerStateTable::pops (std::deque<KeyOpFieldsValuesTuple> &vkco, const std::string& /* prefix*/ )
@@ -51,30 +44,19 @@ void ConsumerStateTable::pops(std::deque<KeyOpFieldsValuesTuple> &vkco, const st
51
44
52
45
RedisCommand command;
53
46
command.format (
54
- " EVALSHA %s 3 %s %s: %s %d %s" ,
47
+ " EVALSHA %s 3 %s %s: %s %d %s %s " ,
55
48
sha.c_str (),
56
49
getKeySetName ().c_str (),
57
50
getTableName ().c_str (),
58
51
getDelKeySetName ().c_str (),
59
52
POP_BATCH_SIZE,
60
- getStateHashPrefix ().c_str ());
53
+ getStateHashPrefix ().c_str (),
54
+ getChannelName ().c_str ());
61
55
62
56
RedisReply r (m_db, command);
63
57
auto ctx0 = r.getContext ();
64
58
vkco.clear ();
65
59
66
- // Check whether the keyset is empty, if not, signal ourselves to process again.
67
- // This is to handle the case where the number of keys in keyset is more than POP_BATCH_SIZE
68
- // Note there is possibility of false positive since this call is not atomic with consumer_state_table_pops.lua
69
- // Putting publish call inside consumer_state_table_pops.lua doesn't seem to work.
70
- command.format (
71
- " EVALSHA %s 2 %s %s %s" ,
72
- m_scardPublish.c_str (),
73
- getChannelName ().c_str (),
74
- getKeySetName ().c_str (),
75
- " G" );
76
- RedisReply r2 (m_db, command);
77
-
78
60
// if the set is empty, return an empty kco object
79
61
if (ctx0->type == REDIS_REPLY_NIL)
80
62
{
0 commit comments