Before of the addNode() or Exists() operations we always remove expired * entries from the black list. This is an O(N) operation but it is not a * problem since add / exists operations are called very infrequently and * the hash table is supposed to contain very little elements at max. * However without the cleanup during long uptime and with some automated * node add/removal procedures, entr
| 1252 | * However without the cleanup during long uptime and with some automated |
| 1253 | * node add/removal procedures, entries could accumulate. */ |
| 1254 | void clusterBlacklistCleanup(void) { |
| 1255 | dictIterator *di; |
| 1256 | dictEntry *de; |
| 1257 | |
| 1258 | di = dictGetSafeIterator(g_pserver->cluster->nodes_black_list); |
| 1259 | while((de = dictNext(di)) != NULL) { |
| 1260 | int64_t expire = dictGetUnsignedIntegerVal(de); |
| 1261 | |
| 1262 | if (expire < g_pserver->unixtime) |
| 1263 | dictDelete(g_pserver->cluster->nodes_black_list,dictGetKey(de)); |
| 1264 | } |
| 1265 | dictReleaseIterator(di); |
| 1266 | } |
| 1267 | |
| 1268 | /* Cleanup the blacklist and add a new node ID to the black list. */ |
| 1269 | void clusterBlacklistAddNode(clusterNode *node) { |
no test coverage detected