On Fri, May 9, 2008 at 6:52 AM, Contact 42 <[EMAIL PROTECTED]> wrote:
>
> Chris Curvey wrote:
>> Hey folks, it's me again!  (I will wait for the groans to
>> subside....good.)
>>
>> I've got two issues, both related to (I think) connection pooling.
>> I'm using Elixir with Pylons.
>>
>> The first issue is that I'm still seeing "old" data show up on my web
>> pages.  I have some background tasks that are updating the database,
>> and if I keep hitting "refresh" in my web browser, the data on the web
>> page seems to go backwards in time.
>>
> sounds like an SA session issue. i.e it's not being cleared before use.
> I saw your code where you clear it on request start, but you have to
> make sure that session object is the same as the one you are using later
> on in your code (trying printing out it's id before using it and also
> before clearing it).

scoped_session should always always give the same session object to
the same thread, at least until it's removed, but it would be worth
verifying that's happening.

> I'm not familiar with Elixir, but is the Session a threadlocal ?
>> The second issue is that if the database (Postgres) has a problem with
>> one of my SQL statements (foreign key violation, duplicate key
>> problem), the connection is left in a state where you have to execute
>> a "rollback" before anything else can happen.   Which causes all
>> future requests that happen to get that DB connection to fail.  The
>> only way I've found to fix the problem is to restart my app server.
>>
> This sounds like the Session has transactional=True. When this is set, I
> think the Session automatically starts a transaction for you. So when an
> error occurs, you have to rollback yourself.

Maybe put a rollback in the base controller before calling the action.

Turning on connection pool logging would show which connections are
being used for which operations.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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