| |
394 |
394 |
set lifetime [parameter::get -package_id [ds_instance_id] -parameter DataLifetime -default 900] |
| |
395 |
395 |
|
| |
396 |
396 |
# Find the last request before the DataLifetime cutoff |
| |
397 |
397 |
|
| |
398 |
398 |
set names [nsv_array names ds_request] |
| |
399 |
399 |
set max_request 0 |
| |
400 |
400 |
foreach name $names { |
| |
401 |
401 |
if { [regexp {^([0-9]+)\.start$} $name match request] |
| |
402 |
402 |
&& $now - [lindex [nsv_get ds_request $name] 0] > $lifetime } { |
| |
403 |
403 |
if {$request > $max_request} { |
| |
404 |
404 |
set max_request $request |
| |
405 |
405 |
} |
| |
406 |
406 |
} |
| |
407 |
407 |
} |
| |
408 |
408 |
|
| |
409 |
409 |
# kill any request older than last request. |
| |
410 |
410 |
|
| |
411 |
411 |
set kill_count 0 |
| |
412 |
412 |
foreach name $names { |
| |
413 |
413 |
if { [regexp {^([0-9]+)\.} $name "" request] |
| |
414 |
|
&& [expr {$request <= $max_request}] } { |
| |
|
414 |
&& $request <= $max_request |
| |
|
415 |
} { |
| |
415 |
416 |
incr kill_count |
| |
416 |
417 |
nsv_unset ds_request $name |
| |
417 |
418 |
} |
| |
418 |
419 |
} |
| |
419 |
420 |
|
| |
420 |
421 |
ns_log "Debug" "Swept developer support information for [array size kill_requests] requests ($kill_count nsv elements)" |
| |
421 |
422 |
} |
| |
422 |
423 |
|
| |
423 |
424 |
ad_proc -private ds_trace_filter { conn args why } { Adds developer-support information about the end of sessions.} { |
| |
424 |
425 |
if { [ds_enabled_p] && [ds_collection_enabled_p] } { |
| |
425 |
426 |
ds_add conn end [ns_time] endclicks [clock clicks -microseconds] |
| |
426 |
427 |
|
| |
427 |
428 |
for { set i 0 } { $i < [ns_set size [ad_conn outputheaders]] } { incr i } { |
| |
428 |
429 |
ds_add oheaders [ns_set key [ad_conn outputheaders] $i] [ns_set value [ad_conn outputheaders] $i] |
| |
429 |
430 |
} |
| |
430 |
431 |
|
| |
431 |
432 |
foreach param { browser_id validated session_id user_id } { |
| |
432 |
433 |
global ad_sec_$param |
| |
433 |
434 |
if { [info exists ad_sec_$param] } { |
| |
434 |
435 |
ds_add conn $param [set "ad_sec_$param"] |