Close broken database before destroying.

GitOrigin-RevId: ed3729139c843caba7d54e02d80262d4fccb81ef
This commit is contained in:
levlam 2019-09-16 22:01:55 +03:00
parent bf3e159d35
commit b34737a562

View File

@ -418,6 +418,9 @@ Status TdDb::init(int32 scheduler_id, const TdParameters &parameters, DbKey key,
VLOG(td_init) << "Finish to init database";
if (init_sqlite_status.is_error()) {
LOG(ERROR) << "Destroy bad SQLite database because of " << init_sqlite_status;
if (sql_connection_ != nullptr) {
sql_connection_->get().close();
}
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
TRY_STATUS(init_sqlite(scheduler_id, parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc));
}