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

Function sentinelPropagateDownAfterPeriod

src/sentinel.cpp:1719–1733  ·  view source on GitHub ↗

This function sets the down_after_period field value in 'master' to all * the slaves and sentinel instances connected to this master. */

Source from the content-addressed store, hash-verified

1717/* This function sets the down_after_period field value in 'master' to all
1718 * the slaves and sentinel instances connected to this master. */
1719void sentinelPropagateDownAfterPeriod(sentinelRedisInstance *master) {
1720 dictIterator *di;
1721 dictEntry *de;
1722 int j;
1723 dict *d[] = {master->slaves, master->sentinels, NULL};
1724
1725 for (j = 0; d[j]; j++) {
1726 di = dictGetIterator(d[j]);
1727 while((de = dictNext(di)) != NULL) {
1728 sentinelRedisInstance *ri = (sentinelRedisInstance*)dictGetVal(de);
1729 ri->down_after_period = master->down_after_period;
1730 }
1731 dictReleaseIterator(di);
1732 }
1733}
1734
1735/* This function is used in order to send commands to Redis instances: the
1736 * commands we send from Sentinel may be renamed, a common case is a master

Callers 2

sentinelSetCommandFunction · 0.85

Calls 3

dictGetIteratorFunction · 0.70
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected