Skip to content

Commit c5ebc79

Browse files
authored
Merge branch 'staging' into manual_sessions
2 parents afdcd28 + 75f8d74 commit c5ebc79

File tree

8 files changed

+48
-22
lines changed

8 files changed

+48
-22
lines changed

.github/workflows/tests.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os:
17-
- ubuntu-20.04
18-
- macos-11.0
19-
- windows-2019
17+
- ubuntu-22.04
18+
- macos-15
19+
- windows-2022
2020

2121
include:
22-
- os: windows-2019
23-
cmake-generator: -G "Visual Studio 16 2019" -A x64
24-
cmake-install: "choco install -y cmake"
25-
dependencies: |
26-
choco install -y openssl
27-
choco install -y visualstudio2017-workload-vctools
28-
choco upgrade -y visualstudio2017-workload-vctools
29-
make: msbuild countly-tests.vcxproj -t:rebuild -verbosity:diag -property:Configuration=Release && .\Release\countly-tests.exe
30-
- os: macos-11.0
31-
cmake-install: "brew install cmake"
32-
dependencies: "brew install openssl"
22+
- os: windows-2022
23+
cmake-generator: -G "Visual Studio 17 2022" -A x64
24+
cmake-install: "" #Already installed on hosted runner
25+
dependencies: "" #Already installed on hosted runner
26+
make: msbuild countly-tests.vcxproj -t:rebuild -verbosity:diag -property:Configuration=Release && .\Release\countly-tests.exe
27+
- os: macos-15
28+
cmake-install: "" #Already installed on hosted runner
29+
dependencies: "" #Already installed on hosted runner
3330
make: make ./countly-tests && ./countly-tests
34-
- os: ubuntu-20.04
35-
cmake-install: "sudo apt-get update && sudo apt-get install -y cmake"
36-
dependencies: "sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev"
31+
- os: ubuntu-22.04
32+
cmake-install: "" #Already installed on hosted runner
33+
dependencies: |
34+
sudo apt-get update && sudo apt-get install -y \
35+
libcurl4-openssl-dev \
36+
libssl-dev
3737
make: make ./countly-tests && ./countly-tests
3838

3939
steps:
@@ -52,11 +52,13 @@ jobs:
5252
run: ${{ matrix.dependencies }}
5353

5454
- name: Set up MSVC
55-
if: matrix.os == 'windows-2019'
55+
if: matrix.os == 'windows-2022'
5656
uses: microsoft/setup-msbuild@v1
5757

5858
- name: Build and run tests
5959
run: |
6060
cmake -DCOUNTLY_BUILD_TESTS=1 -B build . ${{ matrix.cmake-generator }}
6161
cd build
6262
${{ matrix.make }}
63+
env:
64+
CMAKE_POLICY_VERSION_MINIMUM: 3.31

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## XX.XX.XX
22
- Added manual session control, which can be enabled via "Countly::enableManualSessionControl".
3+
- Added "checkRQSize" function to return the current number of requests in the queue.
34

45
## 23.2.0
56
- Request queue processing now is limited to 100 requests at a time

include/countly.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ class Countly : public cly::CountlyDelegates {
107107
*/
108108
int checkEQSize();
109109

110+
/*
111+
* Checks and returns the size of the request queue in memory or persistent storage.
112+
*/
113+
int checkRQSize();
114+
110115
/**
111116
* Checks and returns the size of the event queue in persistent storage.
112117
*/

include/countly/request_module.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class RequestModule {
3535
*/
3636
void clearRequestQueue();
3737

38+
long long RQSize();
39+
3840
private:
3941
class RequestModuleImpl;
4042
std::unique_ptr<RequestModuleImpl> impl;

src/countly.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ void Countly::checkAndSendEventToRQ() {
538538

539539
void Countly::setMaxEvents(size_t value) {
540540
log(LogLevel::WARNING, "[Countly][setMaxEvents/SetMaxEventsPerMessage] These calls are deprecated. Use 'setEventsToRQThreshold' instead.");
541-
setEventsToRQThreshold(value);
541+
setEventsToRQThreshold(static_cast<int>(value));
542542
}
543543

544544
void Countly::setEventsToRQThreshold(int value) {
@@ -869,12 +869,24 @@ int Countly::checkEQSize() {
869869
return event_count;
870870
}
871871

872+
int Countly::checkRQSize() {
873+
log(LogLevel::DEBUG, "[Countly][checkRQSize]");
874+
int request_count = -1;
875+
if (!is_sdk_initialized) {
876+
log(LogLevel::DEBUG, "[Countly][checkRQSize] SDK is not initialized.");
877+
return request_count;
878+
}
879+
880+
request_count = static_cast<int>(requestModule->RQSize());
881+
return request_count;
882+
}
883+
872884
#ifndef COUNTLY_USE_SQLITE
873885
int Countly::checkMemoryEQSize() {
874886
log(LogLevel::DEBUG, "[Countly][checkMemoryEQSize] Checking event queue size in memory");
875887
int result = 0;
876888
mutex->lock();
877-
result = event_queue.size();
889+
result = static_cast<int>(event_queue.size());
878890
mutex->unlock();
879891
return result;
880892
}
@@ -1251,4 +1263,4 @@ void Countly::updateRemoteConfigExcept(std::string *keys, size_t key_count) {
12511263
std::thread _thread(&Countly::_updateRemoteConfigWithSpecificValues, this, data);
12521264
_thread.detach();
12531265
}
1254-
} // namespace cly
1266+
} // namespace cly

src/request_module.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,5 @@ HTTPResponse RequestModule::sendHTTP(std::string path, std::string data) {
341341
return response;
342342
#endif
343343
}
344+
long long RequestModule::RQSize() { return impl->_storageModule->RQCount(); }
344345
} // namespace cly

tests/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include <string>
77

88
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
9+
#ifdef __APPLE__
10+
#define DOCTEST_CONFIG_NO_BREAK_INTO_DEBUGGER
11+
#endif
912

1013
#include "doctest.h"
1114

vendor/doctest

0 commit comments

Comments
 (0)