mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Reduce verbosity of CleanupSession debug logs.
Currently we wait up to 10s for this operation to complete. Replacing the two log lines with three, lets us halve the number of logs printed every 10ms, but always print exactly one log line each iteration of the loop. Rather than: ``` 02-10 19:58:48.880 3140 3140 D CleanupSession: Wait for all Realm instance to be closed (29 - 0) 02-10 19:58:48.880 3140 3140 D CleanupSession: Waiting 10ms 02-10 19:58:48.890 3140 3140 D CleanupSession: Wait for all Realm instance to be closed (29 - 0) 02-10 19:58:48.890 3140 3140 D CleanupSession: Waiting 10ms 02-10 19:58:48.900 3140 3140 D CleanupSession: Wait for all Realm instance to be closed (29 - 0) 02-10 19:58:48.900 3140 3140 D CleanupSession: Waiting 10ms 02-10 19:58:48.910 3140 3140 D CleanupSession: Wait for all Realm instance to be closed (29 - 0) 02-10 19:58:48.910 3140 3140 D CleanupSession: Waiting 10ms 02-10 19:58:48.920 3140 3140 D CleanupSession: Wait for all Realm instance to be closed (0 - 0) ``` We'll print: ``` 02-10 19:58:48.880 3140 3140 D CleanupSession: Waiting 10ms for all Realm instance to be closed (29 - 0) 02-10 19:58:48.890 3140 3140 D CleanupSession: Waiting 10ms for all Realm instance to be closed (29 - 0) 02-10 19:58:48.900 3140 3140 D CleanupSession: Waiting 10ms for all Realm instance to be closed (29 - 0) 02-10 19:58:48.910 3140 3140 D CleanupSession: Waiting 10ms for all Realm instance to be closed (29 - 0) 02-10 19:58:48.920 3140 3140 D CleanupSession: Finished waiting for all Realm instance to be closed (0 - 0) ``` The above example took 40ms to finish and saved 4 log lines; you can see how it adds up if you take 10000ms to finish.
This commit is contained in:
parent
fd89acc112
commit
f44f37629a
1 changed files with 2 additions and 2 deletions
|
@ -94,12 +94,12 @@ internal class CleanupSession @Inject constructor(
|
|||
do {
|
||||
val sessionRealmCount = Realm.getGlobalInstanceCount(realmSessionConfiguration)
|
||||
val cryptoRealmCount = Realm.getGlobalInstanceCount(realmCryptoConfiguration)
|
||||
Timber.d("Wait for all Realm instance to be closed ($sessionRealmCount - $cryptoRealmCount)")
|
||||
if (sessionRealmCount > 0 || cryptoRealmCount > 0) {
|
||||
Timber.d("Waiting ${TIME_TO_WAIT_MILLIS}ms")
|
||||
Timber.d("Waiting ${TIME_TO_WAIT_MILLIS}ms for all Realm instance to be closed ($sessionRealmCount - $cryptoRealmCount)")
|
||||
delay(TIME_TO_WAIT_MILLIS)
|
||||
timeToWaitMillis -= TIME_TO_WAIT_MILLIS
|
||||
} else {
|
||||
Timber.d("Finished waiting for all Realm instance to be closed ($sessionRealmCount - $cryptoRealmCount)")
|
||||
timeToWaitMillis = 0
|
||||
}
|
||||
} while (timeToWaitMillis > 0)
|
||||
|
|
Loading…
Reference in a new issue