Change codes for db lock issue 79/196379/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 28 Dec 2018 02:13:51 +0000 (11:13 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 28 Dec 2018 02:13:51 +0000 (11:13 +0900)
- SQLite connection will be disconnected before cleanup operation.
- Adjust busy timer to 5 sec to prevent db lock issue.

Change-Id: If139d988819e28bd1b1ed733541491ea09ff5be8
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_pkginfo.c
src/pkgmgrinfo_private.c

index d8dbeac..232d75e 100644 (file)
@@ -711,6 +711,9 @@ static int _appinfo_get_applications(uid_t db_uid, uid_t uid,
        ret = PMINFO_R_OK;
 
 catch:
+       sqlite3_finalize(stmt);
+       sqlite3_close_v2(db);
+
        if (constraint)
                free(constraint);
 
@@ -718,8 +721,6 @@ catch:
                pkgmgrinfo_basic_free_application(info);
 
        g_list_free_full(bind_params, free);
-       sqlite3_finalize(stmt);
-       sqlite3_close_v2(db);
 
        return ret;
 }
index aae7c0e..dc8981b 100644 (file)
@@ -594,6 +594,9 @@ static int _pkginfo_get_packages(uid_t uid, const char *locale,
        ret = PMINFO_R_OK;
 
 catch:
+       sqlite3_finalize(stmt);
+       sqlite3_close_v2(db);
+
        if (constraints)
                free(constraints);
 
@@ -604,8 +607,6 @@ catch:
                pkgmgrinfo_pkginfo_filter_destroy(tmp_filter);
 
        g_list_free_full(bind_params, free);
-       sqlite3_finalize(stmt);
-       sqlite3_close_v2(db);
 
        return ret;
 }
index 5fb89a8..04cfb65 100644 (file)
@@ -556,7 +556,7 @@ int __appinfo_check_installed_storage(application_x *appinfo)
 }
 
 #define BUSY_WAITING_USEC (1000000 / 10 / 2) /* 0.05 sec */
-#define BUSY_WAITING_MAX 40 /* wait for max 2 sec */
+#define BUSY_WAITING_MAX 100 /* wait for max 5 sec */
 static int __db_busy_handler(void *data, int count)
 {
        if (count < BUSY_WAITING_MAX) {