Hi all

OK I've just spent far too long fiddling with this but belive I have
achieved what I set out to do.

Ie. If qpopper can't lock the bulletin database it writes a warning to
the log but still lets the user pop their email.  At the same time I've
reduced the number of retries.  I already had code that randomized the
sleep between retries.

As usual USE AT YOUR OWN RISK.   I've attached a diff for pop_dropcopy.c

My code isn't the neatest but as best I can tell it's working fine on
our main server now.  Hopefully this will stop the peaks in load that we
have been seeing and our mail server will now tick along nicely.


Regards

Jon

--
Jonathan Benson
Systems Administrator
Ocean Internet
http://www.ocean.com.au/


135a136,139
> #ifdef BULLDB
> # include <stdlib.h>
> #endif
> 
1088,1090c1092,1094
< #  define SLEEP_INTERVAL 1 /* how long to wait between tries */
< #  define MAX_ATTEMPTS  10 /* when to give up */
<     if (p->bulldir) {
---
> #  define MAX_ATTEMPTS  3 /* when to give up */
> 
> if (p->bulldir) {
1094a1099
>                 int  randsleep = 0;
1110c1115
<             if ( p->bull_db == NULL && errno == EAGAIN
---
>                 if ( p->bull_db == NULL && errno == EAGAIN
1115c1120,1128
<                 sleep ( tries * SLEEP_INTERVAL );   /* Sleep between retries */
---
>                                       /* Added to randomize the sleep period for 
>retrys 
>                                       when unable to lock bulldb - JB 05/30/00 */
>                                       randsleep = 1+(int) 
>(10.0*rand()/(RAND_MAX+1.0));    
> 
> // #if HAVE_UNISTD_H
> //                                    usleep ( (1000 * tries * randsleep) );
> // #else /* probably won't have usleep() */
>                 sleep ( tries + randsleep );   /* Sleep between retries */
> // #endif /* HAVE_UNISTD_H */
1124c1137,1138
<             return ( pop_msg ( p, POP_FAILURE, HERE, 
---
> /* JB 15/8/00 commented out return to avoid failure on fail to lock bulldb */
>             /* return ( pop_msg ( p, POP_FAILURE, HERE, 
1126c1140
<                                "database; contact your administrator" ) );
---
>                                "database; contact your administrator" ) ); */
1526d1539
< 
1539c1552,1556
<         if ( pop_bull ( p, pwp ) != POP_SUCCESS ) {
---
> /* JB 15/8/00 added ifdef to avoid failure on fail to lock bulldb */
> #ifdef BULLDB
>         if ( p->bull_db != NULL ) {
> #endif /* BULLDB */
>                 if ( pop_bull ( p, pwp ) != POP_SUCCESS ) {
1551a1569,1571
> #ifdef BULLDB
>         }
> #endif /* BULLDB */
1554a1575
> if ( p->bull_db != NULL ) {
1559a1581
> }

Reply via email to