[OPEN-ILS-DEV] ***SPAM*** Timeout settings: using interval strings
Scott McKellar
mck9 at swbell.net
Mon Jun 7 11:31:26 EDT 2010
A recent commit in trunk changes the way that timeout intervals may be defined. It is upwardly compatible with current practice, with one possible exception that I need to warn you about.
The default timeout intervals are defined in opensrf.xml, in the app_settings section for the open-ils.auth service. These defaults may be overridden by the following org unit settings:
auth.opac_timeout
auth.staff_timeout
auth.temp_timeout
auth.persistent_login_interval (this one is new)
In the past, these settings consisted of integers representing the duration of the timeout in seconds. With the recent commit, they may also consist of PostgreSQL-style interval strings such as "10 minutes".
The possible exception is if the setting includes a leading plus sign. Until now, such a leading plus sign had no effect. With the recent change, it will cause the timeout value to be denominated in hours instead of seconds.
I doubt that anyone has ever used a leading plus sign for these settings, but it's not impossible. If your installation uses a leading plus sign, I strongly recommend that you remove it.
The rest of this post is copied from the commit notes, to provide the dirty details:
Added a new login type "persist", as a peer of "opac", "staff", and "temp".
It is intended for sessions that may stay open for days or weeks at a time
even in the absence of activity. The default timeout interval is defined
as two weeks in opensrf.xml, and may be overridden by the org unit
setting "auth.persistent_login_interval".
Timeout resets work a little differently for persistent logins. They
have no effect unless the session is within ten minutes of expiring. When
they do take effect, they reset the timeout to ten minutes, rather than to
the full length of the original timeout. That way we can avoid rudely
interrupting an active session without extending it excessively.
The ten minute reset interval for persistent timeouts is currently
hard-coded. With some further work it could be made configurable.
The timeout resets for the older login types still work the way they
always have.
------------
In order to make it easier to specify long timeout intervals, the
auth server now accepts PostgreSQL-style interval strings, such as
"15 minutes" or "2 weeks". Such strings work for any of the login
types, and they work either in opensrf.xml or in the org unit setting
values.
If the timeout setting (in either context) is all digits, then it will
be interpreted as an integral number of seconds, as it has been in the
past. So existing settings will almost certainly continue to work
without change.
The exception -- an unlikely one -- is if the existing setting carries
a leading plus sign. Under the old regime, a leading plus sign was
simply superfluous, and had no effect. With the new version, a
leading plus sign means that the following number is to be treated as
a number of hours, rather than a number of seconds (just because
that's what PostgreSQL does with it).
Hence in the unlikely event that existing settings use a leading
plus sign, this change will make those timeouts 3600 times as long
as they should be.
If the timeout interval is expressed as anything other than a string
of all digits (possibly with leading and/or trailing white space), we
make a database call to get PostgreSQL to interpret it for us. So the
convenience of using interval strings comes at the price of some
additional overhead.
--------------
Besides applying the changes to the C code, it will be necessary to
update the opensrf.xml file in order to define a default timeout
interval for the new login type.
Scott McKellar
More information about the Open-ils-dev
mailing list