修复线程初始化顺序导致Redis异步建联失败问题

This commit is contained in:
fengweihao
2021-05-25 15:28:00 +08:00
parent 3f0c7edd35
commit 8077136bc7
2 changed files with 15 additions and 8 deletions

View File

@@ -123,7 +123,6 @@ static int load_module_config(const char *config)
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "Certsotre redis port invalid");
goto finish;
}
finish:
return xret;
}

View File

@@ -2015,24 +2015,32 @@ redis_link_detection(uint32_t __attribute__((__unused__)) uid,
x509_forge_thread *threads = (x509_forge_thread *)argv;
unsigned int thread_nu = cfg_instanec()->thread_nu;
for (tid = 0; tid < (int)thread_nu; tid++) {
for (tid = 0; tid < (int)thread_nu; tid++)
{
info = threads + tid;
if(info->sync == NULL){
if(info->sync == NULL && info->base != NULL)
{
redisFree(info->sync);
xret = redis_sync_init(&info->sync);
if (xret < 0 || !info->sync){
if (xret < 0 || !info->sync)
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "[%d]trying to connect sync redis failed", tid);
continue;
}else{
}
else
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "[%d]trying to connect sync redis success", tid);
}
if(cfg_instanec()->mode)
{
xret = redis_rsync_init(info->base, &info->cl_ctx);
if (xret < 0 || !info->cl_ctx){
xret = redis_rsync_init(info->base, &info->cl_ctx);
if (xret < 0 || !info->cl_ctx)
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "[%d]trying to connect rsync redis failed", tid);
}else{
}
else
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "[%d]trying to connect rsync redis success", tid);
}
}