[Tutor] Threaded persistance?

Gwyn Evans gwyn.evans at gmail.com
Wed Mar 2 21:59:35 CET 2005


On Wed, 02 Mar 2005 15:53:17 -0500, Kent Johnson <kent37 at tds.net> wrote:
> Gwyn Evans wrote:
> > Hi,
> >   New to Python, but with Java background  I'm interested in
> > comments/suggestions for something I'm trying...
> >
> >   I've got a series of events (basically a dictionary of a few
> > key:value pairs) which I'd like to forward onto a web service.  That
> > should be no problem, but I'm investigating what I can do when the web
> > service is down for a bit.
> >   What I'm considering is to persist the event and trigger a seperate
> > thread to retry the forwarding.  What I'm wondering about is if
> > there's a storage method that allows 1 thread writing to the storage
> > while the other thread reads and then deletes from the storage...
> 
> Do you need to allow for the sending thread to be restarted as well? In other words, does the queue
> have to be persistent? If not, you could use Queue.Queue which is intended for this kind of
> inter-thread communication.

Ideally, yes, although the main issue I was concerned about with
Queue.Queue was that I didn't want to be be limited by memory size...

I guess the final fallback would be going straight to a full-blown DB
with a connection from each thread, but I'm not sure if it's a bit
over the top...

/Gwyn


More information about the Tutor mailing list