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:
parent
8cfa6873c2
commit
da227d5f43
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user