Skip to content

Commit 3e7f86a

Browse files
committed
- Change log updated
- automatic session update interval added
1 parent 7bc130e commit 3e7f86a

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
21.11.1
2+
* ! Minor breaking change ! Default automatic session update duration changed to 60 seconds.
3+
* Added a call to change the automatic session update duration.
4+
* Fixed a bug where session duration was reported wrong.
5+
16
21.11.0
27
* Fixed session duration issue.
38
* Added functionality to report event duration manually.

include/countly.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ class Countly {
207207

208208
addEvent(event);
209209
}
210+
211+
/* Provide 'updateInterval' in seconds. */
212+
inline void setAutomaticSessionUpdateInterval(unsigned short updateInterval) {
213+
_auto_session_update_interval = updateInterval;
214+
}
210215
private:
211216
void log(LogLevel level, const std::string& message);
212217

@@ -236,6 +241,7 @@ class Countly {
236241
bool stop_thread;
237242
bool running;
238243
size_t wait_milliseconds;
244+
unsigned short _auto_session_update_interval = 60; // value is in seconds;
239245

240246
size_t max_events;
241247
#ifndef COUNTLY_USE_SQLITE

src/countly.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ bool Countly::updateSession() {
482482
auto duration = std::chrono::duration_cast<std::chrono::seconds>(getSessionDuration());
483483
mutex.lock();
484484

485-
if (duration.count() * 1000 >= COUNTLY_KEEPALIVE_INTERVAL) {
485+
if (duration.count() >= _auto_session_update_interval) {
486486
log(Countly::LogLevel::DEBUG, "[Countly][updateSession] sending session update.");
487487
std::map<std::string, std::string> data = {
488488
{"app_key", session_params["app_key"].get<std::string>()},

0 commit comments

Comments
 (0)