Start housekeeper before services
The housekeeper needs to be initialized before services are started.
This commit is contained in:
parent
a7df6b55d5
commit
ce98831908
@ -36,7 +36,9 @@ typedef bool (*TASKFN)(void *data);
|
||||
* Initialises the housekeeper mechanism.
|
||||
*
|
||||
* A call to any of the other housekeeper functions can be made only if
|
||||
* this function returns successfully.
|
||||
* this function returns successfully. This function must be called after all
|
||||
* module level initialization is done but before any monitors or services are
|
||||
* started.
|
||||
*
|
||||
* @return True if the housekeeper mechanism was initialized, false otherwise.
|
||||
*/
|
||||
|
@ -2142,6 +2142,15 @@ int main(int argc, char **argv)
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
// Start the housekeeper thread
|
||||
if (!hkinit())
|
||||
{
|
||||
const char* logerr = "Failed to start housekeeper thread.";
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/** Start all monitors */
|
||||
monitorStartAll();
|
||||
|
||||
@ -2176,17 +2185,6 @@ int main(int argc, char **argv)
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the housekeeper thread
|
||||
*/
|
||||
if (!hkinit())
|
||||
{
|
||||
const char* logerr = "Failed to start housekeeper thread.";
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/*<
|
||||
* Start the routing workers running in their own thread.
|
||||
*/
|
||||
|
@ -256,12 +256,14 @@ json_t* Housekeeper::tasks_json(const char* host)
|
||||
|
||||
void hktask_add(const char *name, TASKFN func, void *data, int frequency)
|
||||
{
|
||||
ss_dassert(hk);
|
||||
Task task(name, func, data, frequency);
|
||||
hk->add(task);
|
||||
}
|
||||
|
||||
void hktask_remove(const char *name)
|
||||
{
|
||||
ss_dassert(hk);
|
||||
hk->remove(name);
|
||||
}
|
||||
|
||||
@ -293,6 +295,7 @@ bool hkinit()
|
||||
|
||||
void hkshutdown()
|
||||
{
|
||||
ss_dassert(hk);
|
||||
hk->stop();
|
||||
}
|
||||
|
||||
@ -306,10 +309,12 @@ void hkfinish()
|
||||
|
||||
void hkshow_tasks(DCB *pDcb)
|
||||
{
|
||||
ss_dassert(hk);
|
||||
hk->print_tasks(pDcb);
|
||||
}
|
||||
|
||||
json_t* hk_tasks_json(const char* host)
|
||||
{
|
||||
ss_dassert(hk);
|
||||
return hk->tasks_json(host);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user