Restart worker thread only if the problem was temporary.

In case of persistent problem we don't want to loop forever.

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2010-04-28 22:41:06 +00:00
parent 5abfc9c145
commit 83a5671405
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=207348

View File

@ -140,9 +140,15 @@ child_exit(void)
proto_close(res->hr_ctrl); proto_close(res->hr_ctrl);
res->hr_workerpid = 0; res->hr_workerpid = 0;
if (res->hr_role == HAST_ROLE_PRIMARY) { if (res->hr_role == HAST_ROLE_PRIMARY) {
sleep(1); if (WEXITSTATUS(status) == EX_TEMPFAIL) {
pjdlog_info("Restarting worker process."); sleep(1);
hastd_primary(res); pjdlog_info("Restarting worker process.");
hastd_primary(res);
} else {
res->hr_role = HAST_ROLE_INIT;
pjdlog_info("Changing resource role back to %s.",
role2str(res->hr_role));
}
} }
pjdlog_prefix_set("%s", ""); pjdlog_prefix_set("%s", "");
} }