[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 1 of 3] Temporarily revert c/s 594:41501bb83b18 (session caching stuff)



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1264696398 0
# Node ID 788a15f7eb8618501b754ffdf789c68b24ed40b0
# Parent  22cd3f304b9e0818b80ac5a40e6d4c6438c5e58a
Temporarily revert c/s 594:41501bb83b18 (session caching stuff)

diff -r 22cd3f304b9e -r 788a15f7eb86 ocaml/xapi/db_gc.ml
--- a/ocaml/xapi/db_gc.ml       Thu Jan 21 15:45:09 2010 +0000
+++ b/ocaml/xapi/db_gc.ml       Thu Jan 28 16:33:18 2010 +0000
@@ -205,15 +205,11 @@
 
 let timeout_sessions ~__context =
   let all_sessions = Db.Session.get_internal_records_where ~__context 
~expr:Db_filter_types.True in
-  let external_sessions = List.filter (fun (_, y) -> not 
y.Db_actions.session_pool) all_sessions in
-  let unused_sessions = List.filter
-    (fun (_, y) -> List.for_all (fun t -> Db.Task.get_status ~__context 
~self:t <> `Pending) y.Db_actions.session_tasks
-    ) external_sessions in
   (* Only keep a list of (ref, last_active, uuid) *)
-  let unused_sessions = List.map (fun (x, y) -> x, Date.to_float 
y.Db_actions.session_last_active, y.Db_actions.session_uuid) unused_sessions in
+  let all_sessions = List.map (fun (x, y) -> x, Date.to_float 
y.Db_actions.session_last_active, y.Db_actions.session_uuid) all_sessions in
   (* Definitely invalidate sessions last used long ago *)
   let threshold_time = Unix.time () -. Xapi_globs.inactive_session_timeout in
-  let young, old = List.partition (fun (_, y, _) -> y > threshold_time) 
unused_sessions in
+  let young, old = List.partition (fun (_, y, _) -> y > threshold_time) 
all_sessions in
   (* If there are too many young sessions then we need to delete the oldest *)
   let lucky, unlucky = 
     if List.length young <= Xapi_globs.max_sessions
@@ -229,8 +225,7 @@
         ) sessions in
   (* Only the 'lucky' survive: the 'old' and 'unlucky' are destroyed *)
   if unlucky <> [] 
-  then debug "Number of unused sessions in database (%d/%d) exceeds limit 
(%d): will delete the oldest"
-     (List.length unused_sessions) (List.length all_sessions) 
Xapi_globs.max_sessions;
+  then debug "Number of sessions in database (%d) exceeds limit (%d): will 
delete the oldest" (List.length all_sessions) Xapi_globs.max_sessions;
   cancel "Timed out session because of its age" old;
   cancel "Timed out session because max number of sessions was exceeded" 
unlucky
 
1 file changed, 3 insertions(+), 8 deletions(-)
ocaml/xapi/db_gc.ml |   11 +++--------


Attachment: xen-api.hg-3.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.