acs::Cluster method incoming_request (public)

 <instance of acs::Cluster[i]> incoming_request

Defined in packages/acs-tcl/tcl/cluster-procs.tcl

We received an incoming request from a cluster peer.

Testcases:
No testcase defined.
Source code:
catch {::throttle do incr ::count(cluster:received)}
#ns_log notice "==== [self] incoming_request [ns_conn query]"

ad_try {
    #ns_logctl severity Debug(connchan) on
    #ns_logctl severity Debug(request) on
    #ns_logctl severity Debug(ns:driver) on
    #ns_logctl severity Debug on
    set r [:message decode]
    set receive_timestamp [clock clicks -milliseconds]
    dict with r {
        #
        # We could check here the provided timepstamp and
        # honor only recent requests (protection against
        # replay attacks). However, the allowed requests
        # are non-destructive.
        #
        nsv_set cluster $peer-last-contact $receive_timestamp
        nsv_set cluster $peer-last-request $receive_timestamp
        nsv_incr cluster $peer-count
        ns_log notice "--cluster got cmd='$cmd' from $peer after [expr {$receive_timestamp - $timestamp}]ms"

        set result [:execute $r]
    }
} on error {errorMsg} {
    ns_log notice "--cluster error: $errorMsg"
    ns_return 417 text/plain $errorMsg
} on ok {r} {
    #ns_log notice "--cluster success $result"
    ns_return 200 text/plain $result
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: