procmail
[Top] [All Lists]

Re: Avoiding concurrent mail processing (massive fgrep)?

1998-03-24 14:37:59
Sean Straw wrote,

| So, I tried wrapping the twit recipes in a lockfile:
| 
| :0:$TEMP/FGREPTWITS$LOGEXT
| {
| INCLUDERC=$PMDIR/spam/notwit.rc
| }

Local lockfiles on a brace are ignored unless the brace launches a clone
(then the lockfile because a global lockfile for the clone).

| Two questions:
| 
|       If lockfiling is how one would go about it, what am I doing wrong?
| 
|       If not, HOW would one limit the execution of multiple copies of the
|       fgrep recipes?  Or do I have to go to each individual recipe and
|       put locallockfiles on each of them?

Locking individual recipes in the includerc would not prevent multiple
simultaneous readings of the includerc -- and if the includerc has a
lot of  

  * ? fgrep

conditions, you really do want to serialize accesses to the includerc,
not just writes to the folders where it saves mail.  The way to do that
is a regional lockfile (and unless there was a condition on those braces,
there is no need for them, nor for the :0):

   LOCKFILE=$TEMP/FGREPTWITS$LOGEXT
   INCLUDERC=$PMDIR/spam/notwit.rc
   LOCKFILE

Alternatively, you could put the regional lockfile assignment inside the
includerc, but then the file descriptor to the includerc is held open while
procmail is waiting for the regional lock, so I think it's better to do it
this way.  You could release the regional lock inside the includerc, but by
releasing it in the same place where you take it, you can see for sure that
it does get released.

<Prev in Thread] Current Thread [Next in Thread>