(redis cobra bots) capture most used devices in a zset
This commit is contained in:
parent
6ed8723d7d
commit
5e200a440f
@ -1,6 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All changes to this project will be documented in this file.
|
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
|
## [9.7.2] - 2020-06-11
|
||||||
|
|
||||||
(ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise
|
(ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise
|
||||||
|
@ -60,7 +60,7 @@ namespace ix
|
|||||||
std::string errMsg;
|
std::string errMsg;
|
||||||
if (redisClient.xadd(id, std::to_string(slowFrames), maxLen, errMsg).empty())
|
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;
|
maxLen = 1000;
|
||||||
if (redisClient.xadd(id, std::to_string(slowFrames), maxLen, errMsg).empty())
|
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;
|
return true;
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define IX_WEBSOCKET_VERSION "9.7.2"
|
#define IX_WEBSOCKET_VERSION "9.7.3"
|
||||||
|
Loading…
Reference in New Issue
Block a user