Marcello has asked for the wisdom of the Perl Monks concerning the following question:
Each child process queries the database approx. 2 times per second, processes only its own messages and deletes the record from the queue, so process A only processes the records where the Process field equals A etc.Message Process abc A def D ghi D jkl C
Then a child process only accesses the database when needed, preventing a lot of database selects.SELECT DISTINCT(Process) FROM Queue;
$SIG{USR1} = \&CatchSignal; ... sub CatchSignal { my $signal = shift; if ($signal eq "USR1") { $SIG_CHECK_DATABASE = 1; } } ... if ($SIG_CHECK_DATABASE) { # Process all messages from the database queue $SIG_CHECK_DATABASE = 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Database queueing and signals
by matija (Priest) on Apr 07, 2004 at 08:15 UTC | |
by Marcello (Hermit) on Apr 07, 2004 at 08:25 UTC | |
|
Re: Database queueing and signals
by sgifford (Prior) on Apr 07, 2004 at 14:58 UTC | |
by Marcello (Hermit) on Apr 07, 2004 at 19:48 UTC | |
|
Re: Database queueing and signals
by gnork (Scribe) on Apr 07, 2004 at 15:58 UTC | |
|
Re: Database queueing and signals
by iburrell (Chaplain) on Apr 07, 2004 at 21:34 UTC |