void sqlx_task_reload_lb (struct sqlx_service_s *ss) { static volatile gboolean already_succeeded = FALSE; static volatile guint tick_reload = 0; static volatile guint period_reload = 1; EXTRA_ASSERT(ss != NULL); if (!ss->lb || !ss->nsinfo) return; if (already_succeeded && 0 != (tick_reload++ % period_reload)) return; GError *err = _reload_lbpool(ss->lb, FALSE); if (!err) { already_succeeded = TRUE; period_reload ++; period_reload = CLAMP(period_reload,2,10); tick_reload = 1; } else { GRID_WARN("Failed to reload the LB pool services: (%d) %s", err->code, err->message); g_clear_error(&err); } grid_lbpool_reconfigure(ss->lb, ss->nsinfo); }
void sqlx_task_reload_lb (struct sqlx_service_s *ss) { EXTRA_ASSERT(ss != NULL); ADAPTIVE_PERIOD_DECLARE(); if (!grid_main_is_running ()) return; if (!ss->lb || !ss->nsinfo) return; if (ADAPTIVE_PERIOD_SKIP()) return; GError *err = _reload_lbpool(ss->lb, FALSE); if (!err) { ADAPTIVE_PERIOD_ONSUCCESS(10); } else { GRID_WARN("Failed to reload the LB pool services: (%d) %s", err->code, err->message); g_clear_error(&err); } grid_lbpool_reconfigure(ss->lb, ss->nsinfo); }