[android] #5680 - Adding 1000 event cap to send telemetry data
This commit is contained in:
@@ -88,6 +88,8 @@ public class MapboxEventManager {
|
||||
private static long flushDelayInMillis = 1000 * 60 * 3; // 3 Minutes
|
||||
private static final int SESSION_ID_ROTATION_HOURS = 24;
|
||||
|
||||
private static final int FLUSH_EVENTS_CAP = 1000;
|
||||
|
||||
private static MessageDigest messageDigest = null;
|
||||
|
||||
private static final double locationEventAccuracy = 10000000;
|
||||
@@ -310,6 +312,21 @@ public class MapboxEventManager {
|
||||
new FlushTheEventsTask().execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Centralized method for adding populated event to the queue allowing for cap size checking
|
||||
* @param event Event to add to the Events Queue
|
||||
*/
|
||||
private void putEventOnQueue(@NonNull Hashtable<String, Object> event) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
events.add(event);
|
||||
if (events.size() == FLUSH_EVENTS_CAP) {
|
||||
Log.d(TAG, "eventsSize == flushCap so send data.");
|
||||
flushEventsQueueImmediately();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Location Event to the system for processing
|
||||
* @param location Location event
|
||||
@@ -337,7 +354,7 @@ public class MapboxEventManager {
|
||||
event.put(MapboxEvent.ATTRIBUTE_OPERATING_SYSTEM, operatingSystem);
|
||||
event.put(MapboxEvent.ATTRIBUTE_APPLICATION_STATE, getApplicationState());
|
||||
|
||||
events.add(event);
|
||||
putEventOnQueue(event);
|
||||
|
||||
rotateSessionId();
|
||||
}
|
||||
@@ -376,7 +393,7 @@ public class MapboxEventManager {
|
||||
eventWithAttributes.put(MapboxEvent.ATTRIBUTE_WIFI, getConnectedToWifi());
|
||||
|
||||
// Put Map Load on events before Turnstile clears it
|
||||
events.add(eventWithAttributes);
|
||||
putEventOnQueue(eventWithAttributes);
|
||||
|
||||
// Turnstile
|
||||
pushTurnstileEvent();
|
||||
@@ -403,7 +420,7 @@ public class MapboxEventManager {
|
||||
return;
|
||||
}
|
||||
|
||||
events.add(eventWithAttributes);
|
||||
putEventOnQueue(eventWithAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user