qiscus / qiscus-sdk-android

Qiscus provide everything you need to power up your app with chats. And it's now made simple.
https://www.qiscus.com
Apache License 2.0
201 stars 84 forks source link

implement WAL #75

Closed adicatur closed 5 years ago

adicatur commented 5 years ago

This PR to improve how to handle the deadlcok issue http://tleyden.github.io/blog/2013/11/14/investigating-an-android-sqlite-threading-deadlock/

However, the implementation of Qiscus Chat SDK might be considered as well.

Reference: Based on this article enable WAL allow to read the database during a transaction process https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#enableWriteAheadLogging()

" when write-ahead logging is enabled (by calling this method), write operations occur in a separate log file which allows reads to proceed concurrently. While a write is in progress, readers on other threads will perceive the state of the database as it was before the write began. When the write completes, readers on other threads will then perceive the new state of the database."