[Gllug] Imposing a delay in a pipeline

Richard Jones rich at annexia.org
Tue Apr 13 17:14:02 UTC 2010


On Tue, Apr 13, 2010 at 03:00:15PM +0100, - Tethys wrote:
> Does anyone know of a utility to impose a delay in a pipeline? I want to do:
> 
> 	process_a | delay -5 | process_b
> 
> such that process_b receives data 5 seconds after it was emitted by
> process_a. Any suggestions?

This is more complex than it seems.

I had a go at coding this up in Perl using nonblocking reads,
select(2), and timestamping each message as it comes in.  Well I got
bored and gave up :-(  But you'll need all of that, and non-blocking
writes, and an expandable buffer of messages (what if the write side
blocks?)

Since this is for delaying trades, isn't there a legal requirement to
get this right?  Maybe look at a real messaging system ...

Rich.

-- 
Richard Jones
Red Hat
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list