1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-29 21:47:30 +03:00

r7961: randomize reloading so that smbds do not pverload cupsd

by reloading printers all at the same time.
						sss
This commit is contained in:
Simo Sorce 2005-06-27 22:44:57 +00:00 committed by Gerald (Jerry) Carter
parent 8cfa6873c2
commit da227d5f43

View File

@ -1299,6 +1299,7 @@ static int setup_select_timeout(void)
void check_reload(int t)
{
static pid_t mypid = 0;
static time_t last_smb_conf_reload_time = 0;
static time_t last_printer_reload_time = 0;
time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
@ -1314,6 +1315,15 @@ void check_reload(int t)
last_printer_reload_time = t;
}
if (mypid != getpid()) { /* First time or fork happened meanwhile */
/* randomize over 60 second the printcap reload to avoid all
* process hitting cupsd at the same time */
int time_range = 60;
last_printer_reload_time += random() % time_range;
mypid = getpid();
}
if (reload_after_sighup || (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK)) {
reload_services(True);
reload_after_sighup = False;