diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f5f86d79..b499a9ca 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 diff --git a/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp b/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp index 61fee3dd..ae5aa2bb 100644 --- a/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp +++ b/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp @@ -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 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; diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index e24e49ed..5e6666d4 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.7.2" +#define IX_WEBSOCKET_VERSION "9.7.3" diff --git a/makefile b/makefile index 3ab52aac..0779b287 100644 --- a/makefile +++ b/makefile @@ -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