::Users proc nr_users_time_window (public)

 ::Users[i] nr_users_time_window

Defined in packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl

Returns:
number of different IP addresses and authenticated users (in time window)

Partial Call Graph (max 5 caller/called nodes):
%3 xo::is_ip xo::is_ip ::throttle ::Users proc nr_users_time_window ::throttle ::Users proc nr_users_time_window ::throttle ::Users proc nr_users_time_window->xo::is_ip

Testcases:
No testcase defined.
Source code:
set ip 0; set auth 0; set reverseAuthDict {}; set ipDict {}
#
# Separate "pa" data into authenticated and not-authenticated, where
# we use the authenticated data as a reverse lookup dict later.
#
foreach {k v} [array get :pa] {
  if {[::xo::is_ip $k]} {
    lappend ipDict $k $v
  } else {
    lappend reverseAuthDict $v $k
    incr auth
  }
}
#
# Don't count cases from the ipDict which are already counted in
# for the auth cases. This assumes that from one IP address, there
# is never a person connected authenticated and not authenticated
# at the same time in the give time window. If it is, it is
# ignored in the statistics.
#
foreach {k v} $ipDict {
  if {![dict exists $reverseAuthDict $v]} {
    incr ip
  }
}
return [list $ip $auth]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: