DanielSerdyukov/alchemy

'database is locked' constantly error

YuriDenison opened this issue · 1 comments

Hi,

I constantly get the message below on start of my application, switching fragments, etc.
On start of my fragments I run db queries on Shedulers.io() like:

RxSQLite.query(ActivityEvent.class, new     RxSQLiteWhere().orderByDesc(ActivityEvent.Columns.DATE)).toList()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(activityEvents -> mBaseView.provideListView().setDataList(activityEvents), Logger::error);

Could you please suggest some technique how I can avoid these types of errors?

database is locked, while executing: CREATE TABLE IF NOT EXISTS activities(_id INTEGER PRIMARY KEY ON CONFLICT REPLACE, server_id TEXT, type TEXT, date INTEGER, user_id TEXT, user_avatar TEXT, user_nickname TEXT, post_id TEXT, post_preview TEXT, UNIQUE(server_id) ON CONFLICT REPLACE);
                                   sqlite4a.SQLiteException: database is locked, while executing: CREATE TABLE IF NOT EXISTS activities(_id INTEGER PRIMARY KEY ON CONFLICT REPLACE, server_id TEXT, type TEXT, date INTEGER, user_id TEXT, user_avatar TEXT, user_nickname TEXT, post_id TEXT, post_preview TEXT, UNIQUE(server_id) ON CONFLICT REPLACE);
                                       at sqlite4a.SQLiteDb.nativeExec(Native Method)
                                       at sqlite4a.SQLiteDb.exec(Unknown Source)
                                       at com.xxx.model.data.ActivityEvent$$Table.create(ActivityEvent$$Table.java:22)
                                       at rxsqlite.RxSQLiteClient.a(Unknown Source)
                                       at rxsqlite.RxSQLiteClient$2.a(Unknown Source)
                                       at rxsqlite.RxSQLiteClient$2.call(Unknown Source)`

The issue is reproducable on 3.2.0, fixed in 3.2.1.
Please update Readme to have latest version stated there and add new gh release.