David Nicol wrote:
On 9/1/05, Bob Dodds <[EMAIL PROTECTED]> wrote:
To implement I want to use IPC::DirQueue.
[...]
It's site-specific spaghetti right now.
IPC::DirQueue uses FIFO, but in e-mail processing we want
to backoff our retries.
I implemented a directory-based queueing system for
TipJar::MTA, you're welcome to chip it out and wrap
I grabbed TipJar::MTA::queue and will look at it.
I'm just superficially scanning things because a
friend was shot to death Friday and the funeral's
coming up Saturday. I have extra things to do
but discussing principles doesn't take long.
a nice interface around it. It uses C<rename> to put
redeferred jobs into their new schedule slots, so its lighter
on the FS than if it had to write them out again, plus
we can figure a jobs age, for determining backoff length,
by checking the file's mtime.
Altering it to use a directory instead of a file would allow
arbitrary additional info to associate with a task, just like
IPC::DirQueue, except with backoff instead of FIFO.
Or maybe my brief scan of the IPC::DirQueue perldoc
missed that it can schedule things to enter the do-soon
state at arbitrary points in the future.
David
I was thinking of writing to file like plugin
http://perlq.org/user_maildir.html
and then giving the path for the file
to ipc dirqueue. Then a node asks
for work, receives a lock, does the
work if it can, if so deletes the file
and tells ipc dirqueue it finished, if not
it lies to ipc dirqueue and reports that
it finished but leaves the file in place, so
ipc dirqueue does not know about the real
file, and ipc dirqueue deletes its file with the
path inside, and the node then submits the
same string including path plus scheduling
and number of retries info as a new ipc
dirqueue object(hope I can remember this
well I just wrote it down here). Would that
list the same file at the end of the queue
within ipc dirqueue?
I'm using these for the localpart to make it
safe while allowing rfc legal chars including
spaces, and in fact any chars are safely
aliased--
sub asc2hex {
my $s = '' ;
return $s unless $#_ + 1 ;
$s = $s . pack 'a2' , $_ for unpack '(H2)*' , $_[0] ;
return $s ;
}
sub hex2asc {
my ( $a , $i , $s ) = ( 0 , 0 , '' ) ;
return $s unless $#_ + 1 ;
$s = $s . pack 'H2' , $_ for unpack '(a2)*' , $_[0] ;
return $s ;
}
-Bob