Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UDR
Commits
2a295c1a
Commit
2a295c1a
authored
Jun 21, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
fc93178e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
40 deletions
+5
-40
src/common/udr.h
src/common/udr.h
+3
-6
src/udr_app/mysql_db.cpp
src/udr_app/mysql_db.cpp
+2
-34
No files found.
src/common/udr.h
View file @
2a295c1a
...
...
@@ -27,18 +27,15 @@
#define HEART_BEAT_TIMER 10
#define DB_CONNECTION_TIMER 10
#define DB_CONNECTION_TIMER 1800 // 30 minutes
#define MAX_FIRST_CONNECTION_RETRY 100
#define MAX_CONNECTION_RETRY 1
#define _unused(x) ((void) (x))
#define U64_FMT "%" PRIu64
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define UDR_NF_REGISTER_URL "/nf-instances/"
#define MAX_FIRST_CONNECTION_RETRY 300
#define MAX_CONNECTION_RETRY 3
#define NUDR_DR_BASE "/nudr-dr/"
#define NUDR_DR_AUTH_STATUS "authentication-status"
#define NUDR_DR_AUTH_SUBS "authentication-subscription"
...
...
src/udr_app/mysql_db.cpp
View file @
2a295c1a
...
...
@@ -63,38 +63,6 @@ bool mysql_db::initialize() {
Logger
::
udr_mysql
().
error
(
"Cannot initialize MySQL"
);
throw
std
::
runtime_error
(
"Cannot initialize MySQL"
);
}
/*
int MAX_RETRY=3;
int i=0;
while (i < MAX_RETRY) {
if (!mysql_real_connect(
&mysql_connector, udr_cfg.mysql.mysql_server.c_str(),
udr_cfg.mysql.mysql_user.c_str(),
udr_cfg.mysql.mysql_pass.c_str(), udr_cfg.mysql.mysql_db.c_str(), 0, 0, 0)) {
Logger::udr_mysql().error(
"An error occurred while connecting to MySQL DB: %s, retry
...", mysql_error(&mysql_connector)); i++;
// throw std::runtime_error("Cannot connect to MySQL DB");
} else {
break;
}
}
if (i==MAX_RETRY){
throw std::runtime_error("Cannot connect to MySQL DB");
}
*/
/*
if (!mysql_real_connect(
&mysql_connector, udr_cfg.mysql.mysql_server.c_str(),
udr_cfg.mysql.mysql_user.c_str(), udr_cfg.mysql.mysql_pass.c_str(),
udr_cfg.mysql.mysql_db.c_str(), 0, 0, 0)) {
Logger::udr_mysql().error(
"An error occurred while connecting to MySQL DB: %s",
mysql_error(&mysql_connector));
throw std::runtime_error("Cannot connect to MySQL DB");
}
*/
return
true
;
}
...
...
@@ -155,13 +123,13 @@ void mysql_db::trigger_connection_handling_procedure(uint64_t ms) {
// _unused(ms);
Logger
::
udr_mysql
().
debug
(
"Trigger Connection Handling procedure %ld"
,
ms
);
if
(
!
connect
(
1
))
{
if
(
!
connect
(
MAX_CONNECTION_RETRY
))
{
Logger
::
udr_app
().
warn
(
"Reset the connection and try again ..."
);
// If couldn't connect to the DB
// Reset the connection and try again
close_connection
();
initialize
();
if
(
!
connect
(
1
))
if
(
!
connect
(
MAX_CONNECTION_RETRY
))
Logger
::
udr_app
().
warn
(
"Could not establish the connection to the DB"
);
}
else
{
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment