-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration cleaning up invalid cached outcomes
Clean up invalid cached os__session_duration outcome records with zero session_time produced in SDK versions 5.1.15 to 5.1.20 so we stop sending these requests to the backend.
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...n/java/com/onesignal/session/internal/outcomes/migrations/RemoveZeroSessionTimeRecords.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.onesignal.session.internal.outcomes.migrations | ||
|
||
import com.onesignal.core.internal.database.IDatabaseProvider | ||
import com.onesignal.session.internal.outcomes.impl.OutcomeEventsTable | ||
|
||
/** | ||
* Purpose: Clean up invalid cached os__session_duration outcome records | ||
* with zero session_time produced in SDK versions 5.1.15 to 5.1.20 so we stop | ||
* sending these requests to the backend. | ||
* | ||
* Issue: SessionService.backgroundRun() didn't account for it being run more | ||
* than one time in the background, when this happened it would create a | ||
* outcome record with zero time which is invalid. | ||
*/ | ||
object RemoveZeroSessionTimeRecords { | ||
fun run(databaseProvider: IDatabaseProvider) { | ||
databaseProvider.os.delete( | ||
OutcomeEventsTable.TABLE_NAME, | ||
OutcomeEventsTable.COLUMN_NAME_NAME + " = \"os__session_duration\"" + | ||
" AND " + OutcomeEventsTable.COLUMN_NAME_SESSION_TIME + " = 0", | ||
null, | ||
) | ||
} | ||
} |