Skip to content

Commit

Permalink
close
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofrancis committed Dec 22, 2020
1 parent f979fc6 commit 81c67d7
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -115,7 +115,7 @@ class FetchDatabaseManagerImpl constructor(context: Context,
database.execSQL("UPDATE ${DownloadDatabase.TABLE_NAME} SET "
+ "${DownloadDatabase.COLUMN_EXTRAS} = '?' "
+ "WHERE ${DownloadDatabase.COLUMN_ID} = ?",
arrayOf(extras.toJSONString(),id)
arrayOf(extras.toJSONString(), id)
)
database.setTransactionSuccessful()
database.endTransaction()
Expand Down Expand Up @@ -179,7 +179,7 @@ class FetchDatabaseManagerImpl constructor(context: Context,

override fun getDownloadsInGroupWithStatus(groupId: Int, statuses: List<Status>): List<DownloadInfo> {
throwExceptionIfClosed()
var downloads = requestDatabase.requestDao().getByGroupWithStatus(groupId, statuses)
var downloads = requestDatabase.requestDao().getByGroupWithStatus(groupId, statuses)
if (sanitize(downloads)) {
downloads = downloads.filter { download ->
statuses.any { it == download.status }
Expand Down Expand Up @@ -332,7 +332,16 @@ class FetchDatabaseManagerImpl constructor(context: Context,
return
}
closed = true
requestDatabase.close()
try {
database.close()
} catch (e: Exception) {

}
try {
requestDatabase.close()
} catch (e: Exception) {

}
logger.d("Database closed")
}

Expand Down

0 comments on commit 81c67d7

Please sign in to comment.