Delete empty pubsub keys (#3146)

We found that there are large amount of pub-sub keys with no content in it (This case is worse when wait-id is used in the key name.).
This logic of deleting empty pub-sub keys from GCS was in legacy ray but not in raylet.
This commit is contained in:
Yuhong Guo 2018-10-28 02:58:39 +08:00 committed by Robert Nishihara
parent 6531eed2d0
commit befbf78048

View file

@ -544,6 +544,10 @@ int TableCancelNotifications_RedisCommand(RedisModuleCtx *ctx, RedisModuleString
if (RedisModule_KeyType(notification_key) != REDISMODULE_KEYTYPE_EMPTY) {
RAY_CHECK(RedisModule_ZsetRem(notification_key, client_channel, NULL) ==
REDISMODULE_OK);
size_t size = RedisModule_ValueLength(notification_key);
if (size == 0) {
CHECK_ERROR(RedisModule_DeleteKey(notification_key), "Unable to delete zset key.");
}
}
RedisModule_ReplyWithSimpleString(ctx, "OK");