Skip to content

Commit 96d5036

Browse files
committed
add wal_checkpoint for later use
1 parent 6196b96 commit 96d5036

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/kotlin/com/zoffcc/applications/trifa/TrifaToxService.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,10 @@ class TrifaToxService
145145
catch(_: Exception)
146146
{
147147
}
148-
Log.i(TAG, "XXXXX:checkpoint:001=" + OrmaDatabase.run_query_for_single_result("PRAGMA wal_checkpoint(TRUNCATE);"))
149148
clear_friends()
150149
load_friends()
151150
clear_groups()
152151
load_groups()
153-
Log.i(TAG, "XXXXX:checkpoint:001=" + OrmaDatabase.run_query_for_single_result("PRAGMA wal_checkpoint(TRUNCATE);"))
154152
// --------------- bootstrap ---------------
155153
// --------------- bootstrap ---------------
156154
// --------------- bootstrap ---------------
@@ -419,6 +417,20 @@ class TrifaToxService
419417
(ToxServiceThread as Thread).start()
420418
}
421419

420+
fun wal_checkpoint()
421+
{
422+
OrmaDatabase.orma_global_writeLock.lock()
423+
try
424+
{
425+
Thread.sleep(10)
426+
Log.i(TAG, "XXXXX:checkpoint:001=" + OrmaDatabase.run_query_for_single_result("PRAGMA wal_checkpoint(TRUNCATE);"))
427+
}
428+
finally
429+
{
430+
OrmaDatabase.orma_global_writeLock.unlock()
431+
}
432+
}
433+
422434
fun tox_audio_play_thread_start()
423435
{
424436
var sw_t = -1L
@@ -1351,7 +1363,6 @@ class TrifaToxService
13511363
{
13521364
tox_self_get_friend_list()?.forEach {
13531365
// Log.i(TAG, "friend:" + it)
1354-
13551366
var f: FriendList? = null
13561367
val f_pubkey = tox_friend_get_public_key(it)
13571368
var fl: MutableList<FriendList>? = null

0 commit comments

Comments
 (0)