Forum Discussion
Kai_Wilke
Feb 02, 2016MVP
Hi Ingard,
I've added additional error handles to avoid any can't read "debug(xyz)": no such variable errors. In addition I've moved the [after] code to the HTTP_REQUEST_SEND event to not depend on the LB_SELECTED getting triggered.
when RULE_INIT {
set static::timeout 10000 ; msec
}
when HTTP_REQUEST {
set debug(request_url) "[HTTP::host][HTTP::uri]"
}
when HTTP_REQUEST_SEND {
set debug(server_addr) "[LB::server addr]"
set debug(id) [after $static::timeout {
if { [info exist debug(server_addr)] and [info exist debug(request_url)] } then {
log local0.warn "$static::timeout msec timeout reached on Node \"$debug(server_addr)\" for \"$debug(request_url)\""
} elseif { [info exist debug(request_url)] } then {
log local0.warn "$static::timeout msec timeout reached on Node \"UNKNOWN\" for \"$debug(request_url)\""
}
}]
}
when HTTP_RESPONSE {
if { [info exist debug(id)] } then {
after cancel $debug(id)
}
unset -nocomplain debug
}
when CLIENT_CLOSED {
if { [info exist debug(server_addr)] and [info exist debug(request_url)] } then {
log local0.warn "Connection closed without HTTP response on Node \"$debug(server_addr)\" for \"$debug(request_url)\""
} elseif { [info exist debug(request_url)] } then {
log local0.warn "Connection closed without HTTP response on Node \"UNKNOWN\" for \"$debug(request_url)\""
}
}
Cheers, Kai