Hi List,

I have a situation where my Pylons app needs to do something every
minute, while still being responsive to client requests. My solution
to this was to create a thread within app_globals, and have this
thread do it's thing, then sleep for a minute.

Functionally, this does appear to do what I want. However, there's two
issues that may be related.

The minor one is that I can't seem to access the config file from this
other thread. "from pylons import config" gives me something different
than it does in requests from clients.

The major one is that I'm getting SQLAlchemy QueuePool errors,
specifically:
TimeoutError: QueuePool limit of size 5 overflow 10 reached,
connection timed out, timeout 30

>From what I've read, this implies that I'm opening connections but not
closing them. The app is not very busy, and at most has two requests
coming in simultaneously, so it definitely seems like I have a design
problem somewhere, rather than a load problem.

Both my client requests and my scheduler thread access the same
session object, imported from model.meta (though in the case of the
scheduler, it's imported by app_globals, and passed in). I'm wondering
if there's some issue with the fact that the scheduler thread doesn't
end. Perhaps the ?threads? that handle requests are doing some kind of
SQLAlchemy cleanup when they end?

I do make sure to do a session.commit() any place where I might modify
data, but if all I do is read data, I generally don't do anything to
close the session. Should I? If so, what?

Thanks,
Alec

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to