There are several changes to the batching functionality:
Removed LeanplumDataBaseManager.migrateFromSharedPreferences as the migration was done several years ago and there aren't any clients using such old sdk version.
Removed synchronized (Request.class) synchronisation code from several places. All of the code was running synced except the LeanplumDataBaseManager.migrateFromSharedPreferences method, which is now removed.
Moved the old inner class RequestsWithEncoding to a separate RequestBatch.java.
Moved the batching codebase from RequestSender to a RequestBatchFactory class. It contains several new public methods:
createErrorBatch - called if there is DB error
createNextBatch - gets the next batch of events from DB
deleteFinishedBatch - deletes the events from DB
UUID parameter
After discussion with backend guys the request UUID param needs to be persisted with the requests in the DB because on server-side there is a 'dedup' logic that compares them by uuid and reqId parameters, and ignores the duplicates.
Moved all UUID related code to RequestUuidHelper.java. It contains several public methods:
deleteUuid - deletes the current uuid from shared prefs
saveNewUuid - saves a new uuid in shared prefs
loadUuid - loads the current uuid from shared prefs
attachUuid - attaches uuid parameter to the event
attachNewUuid(List) - attaches new uuid parameter to every event in the list. The new uuid is not saved in shared prefs
Background
There are several changes to the batching functionality:
Removed
LeanplumDataBaseManager.migrateFromSharedPreferences
as the migration was done several years ago and there aren't any clients using such old sdk version.Removed
synchronized (Request.class)
synchronisation code from several places. All of the code was running synced except theLeanplumDataBaseManager.migrateFromSharedPreferences
method, which is now removed.Moved the old inner class
RequestsWithEncoding
to a separateRequestBatch.java
.Moved the batching codebase from
RequestSender
to aRequestBatchFactory
class. It contains several new public methods:createErrorBatch
- called if there is DB errorcreateNextBatch
- gets the next batch of events from DBdeleteFinishedBatch
- deletes the events from DBUUID parameter After discussion with backend guys the request UUID param needs to be persisted with the requests in the DB because on server-side there is a 'dedup' logic that compares them by uuid and reqId parameters, and ignores the duplicates.
Moved all UUID related code to
RequestUuidHelper.java
. It contains several public methods:deleteUuid
- deletes the current uuid from shared prefssaveNewUuid
- saves a new uuid in shared prefsloadUuid
- loads the current uuid from shared prefsattachUuid
- attaches uuid parameter to the eventattachNewUuid(List)
- attaches new uuid parameter to every event in the list. The new uuid is not saved in shared prefs