Re: Automatic Session Save in Transaction.py

Steve Schwarz <[email protected]> Thu, 3 Mar 2011 11:21:30 -0600
Newsgroups gmane.comp.python.webware
Message-ID <[email protected]>
--===============8205233250267712632==
Content-Type: multipart/alternative; boundary=00032555adf29f54a0049d97429f

--00032555adf29f54a0049d97429f
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Mar 3, 2011 at 9:28 AM, Christoph Zwerschke <[email protected]> wrote:

> IMHO the most simple solution would be to keep a "dirty flag" (set
> whenever __setitem__ or __delitem__ is called for the session) and then
> save the session only when the dirty flag has been set. This will also
> be good for performance. We could also add an AppConfig setting for
> manual saving (False by default to maintain backward compatibility). In
> this case, the dirty flag would not be set automatically, but by calling
> a save() method on the session.
>
> But I'm already seeing a problem with that approach: Since the
> lastAccessTime is stored along with the session, it will not get updated
> if the session is not saved, so the session will expire too early if the
> user does not do anything that alters the session.
>

I kind of don't care if the lastAccessTime isn't updated in this session
saving "mode". We use very long session expiry times so if a "read only"
user had to relogin a little more frequently I don't think it would be an
issue that anyone would notice. Also for our system at some point they will
perform an action that modifies the session.

Since this is a new feature which Webware users would have to turn on I'd
recommend we do "the simplest thing that works" and provide a new config
setting for Sessions that takes multiple values:
"EveryRequest" - default and current functionality
"WhenChanged" - only saves when add/delete has been called

Best Regards,
Steve

--00032555adf29f54a0049d97429f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">On Thu, Mar 3, 2011 at 9:28 AM, Christoph Zwersc=
hke <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">[email protected]<=
/a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
IMHO the most simple solution would be to keep a &quot;dirty flag&quot; (se=
t<br>
whenever __setitem__ or __delitem__ is called for the session) and then<br>
save the session only when the dirty flag has been set. This will also<br>
be good for performance. We could also add an AppConfig setting for<br>
manual saving (False by default to maintain backward compatibility). In<br>
this case, the dirty flag would not be set automatically, but by calling<br=
>
a save() method on the session.<br>
<br>
But I&#39;m already seeing a problem with that approach: Since the<br>
lastAccessTime is stored along with the session, it will not get updated<br=
>
if the session is not saved, so the session will expire too early if the<br=
>
user does not do anything that alters the session.<br></blockquote><div>=A0=
</div><div>I kind of don&#39;t care if the lastAccessTime isn&#39;t updated=
 in this session saving &quot;mode&quot;. We use very long session expiry t=
imes so if a &quot;read only&quot; user had to relogin a little more freque=
ntly I don&#39;t think it would be an issue that anyone would notice. Also =
for our system at some point they will perform an action that modifies the =
session.</div>
<div><br></div><div>Since this is a new feature which Webware users would h=
ave to turn on I&#39;d recommend we do &quot;the simplest thing that works&=
quot; and provide a new config setting for Sessions that takes multiple val=
ues:</div>
<div>&quot;EveryRequest&quot; - default and current functionality</div><div=
>&quot;WhenChanged&quot; - only saves when add/delete has been called</div>=
<div><br></div>Best Regards,</div>
Steve<br><br>

--00032555adf29f54a0049d97429f--


--===============8205233250267712632==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
--===============8205233250267712632==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Webware-discuss mailing list
Webware-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/webware-discuss

--===============8205233250267712632==--