Browse code

usrloc: unnecessary periodic db queries cancelled

korayvt authored on 04/05/2021 12:07:38
Showing 2 changed files
... ...
@@ -960,7 +960,9 @@ int synchronize_all_udomains(int istart, int istep)
960 960
 				res |= db_timer_udomain(ptr->d);
961 961
 			}
962 962
 		}
963
-		ul_ka_db_records((unsigned int)istart);
963
+		if (ul_ka_mode != ULKA_NONE) {
964
+			ul_ka_db_records((unsigned int)istart);
965
+		}
964 966
 	} else {
965 967
 		for( ptr=_ksr_ul_root ; ptr ; ptr=ptr->next) {
966 968
 			mem_timer_udomain(ptr->d, istart, istep);
... ...
@@ -1094,8 +1094,10 @@ int db_timer_udomain(udomain_t* _d)
1094 1094
 	db_val_t vals[3];
1095 1095
 	int key_num = 2;
1096 1096
 
1097
-	/* call contact expired call back for a domain before deleting database rows */
1098
-	udomain_contact_expired_cb(ul_dbh, _d);
1097
+	/* If contact-expired callback exists, run it for a domain before deleting database rows */
1098
+	if (exists_ulcb_type(UL_CONTACT_EXPIRE)) {
1099
+		udomain_contact_expired_cb(ul_dbh, _d);
1100
+	}
1099 1101
 
1100 1102
 	keys[0] = &ul_expires_col;
1101 1103
 	ops[0] = "<";