(redis cobra bots) capture most used devices in a zset

This commit is contained in:
Benjamin Sergeant 2020-06-11 18:49:45 -07:00
parent 6ed8723d7d
commit 5e200a440f
4 changed files with 27 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# Changelog
All changes to this project will be documented in this file.
## [9.7.3] - 2020-06-11
(redis cobra bots) capture most used devices in a zset
## [9.7.2] - 2020-06-11
(ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise

View File

@ -60,7 +60,7 @@ namespace ix
std::string errMsg;
if (redisClient.xadd(id, std::to_string(slowFrames), maxLen, errMsg).empty())
{
CoreLogger::info(std::string("redis xadd error: ") + errMsg);
CoreLogger::info(std::string("redis XADD error: ") + errMsg);
}
//
@ -77,7 +77,26 @@ namespace ix
maxLen = 1000;
if (redisClient.xadd(id, std::to_string(slowFrames), maxLen, errMsg).empty())
{
CoreLogger::info(std::string("redis xadd error: ") + errMsg);
CoreLogger::info(std::string("redis XADD error: ") + errMsg);
}
//
// Add device to the device zset, and increment the score
// so that we know which devices are used more than others
// ZINCRBY myzset 1 one
//
ss.str(""); // reset the stringstream
ss << msg["id"].asString() << "_slow_frames_devices" << "."
<< msg["device"]["game"].asString();
id = ss.str();
std::vector<std::string> args = {
"ZINCRBY", id, "1", deviceId
};
auto response = redisClient.send(args, errMsg);
if (response.first == RespType::Error)
{
CoreLogger::info(std::string("redis ZINCRBY error: ") + errMsg);
}
return true;

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "9.7.2"
#define IX_WEBSOCKET_VERSION "9.7.3"

View File

@ -234,7 +234,7 @@ doc:
mkdocs gh-deploy
change:
vi ixwebsocket/IXWebSocketVersion.h docs/CHANGELOG.md
vim ixwebsocket/IXWebSocketVersion.h docs/CHANGELOG.md
.PHONY: test
.PHONY: build