Utilize timestamp from table instead of relying on getCurrentMillis.

This commit is contained in:
Alex Hart
2023-09-25 15:17:12 -03:00
committed by Cody Henthorne
parent fde0f3bba1
commit f5215d715a
2 changed files with 15 additions and 4 deletions

View File

@@ -94,10 +94,10 @@ class CallLogRepository(
fun deleteAllCallLogsOnOrBeforeNow(): Single<Int> {
return Single.fromCallable {
SignalDatabase.rawDatabase.withinTransaction {
val now = System.currentTimeMillis()
SignalDatabase.calls.deleteNonAdHocCallEventsOnOrBefore(now)
SignalDatabase.callLinks.deleteNonAdminCallLinksOnOrBefore(now)
ApplicationDependencies.getJobManager().add(CallLogEventSendJob.forClearHistory(now))
val latestTimestamp = SignalDatabase.calls.getLatestTimestamp()
SignalDatabase.calls.deleteNonAdHocCallEventsOnOrBefore(latestTimestamp)
SignalDatabase.callLinks.deleteNonAdminCallLinksOnOrBefore(latestTimestamp)
ApplicationDependencies.getJobManager().add(CallLogEventSendJob.forClearHistory(latestTimestamp))
}
SignalDatabase.callLinks.getAllAdminCallLinksExcept(emptySet())