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

Function pubsubUnsubscribeAllPatterns

src/pubsub.cpp:277–291  ·  view source on GitHub ↗

Unsubscribe from all the patterns. Return the number of patterns the * client was subscribed from. */

Source from the content-addressed store, hash-verified

275/* Unsubscribe from all the patterns. Return the number of patterns the
276 * client was subscribed from. */
277int pubsubUnsubscribeAllPatterns(client *c, int notify) {
278 serverAssert(GlobalLocksAcquired());
279 listNode *ln;
280 listIter li;
281 int count = 0;
282
283 listRewind(c->pubsub_patterns,&li);
284 while ((ln = listNext(&li)) != NULL) {
285 robj *pattern = (robj*)ln->value;
286
287 count += pubsubUnsubscribePattern(c,pattern,notify);
288 }
289 if (notify && count == 0) addReplyPubsubPatUnsubscribed(c,NULL);
290 return count;
291}
292
293/* Publish a message */
294int pubsubPublishMessage(robj *channel, robj *message) {

Callers 4

punsubscribeCommandFunction · 0.85
RM_CallFunction · 0.85
freeClientFunction · 0.85
resetCommandFunction · 0.85

Calls 5

GlobalLocksAcquiredFunction · 0.85
listRewindFunction · 0.85
listNextFunction · 0.85
pubsubUnsubscribePatternFunction · 0.85

Tested by

no test coverage detected