FilterHandlerTimeout()

new FilterHandlerTimeout()

This filter is used for warning there is a timeout in handling a request. It will start a timer in its beforeFilter and clear it in its afterFilter. If afterFilter is called before the timer expiring, that means no timout occurs, the timer will be cleared in afterFilter. If the timer expires, but afterFilter is not yet called, that means a timeout occurs and a warning is thrown out and logged. The default timeout is 3 seconds, but you can configure it while loading it.
这个filter是用来对服务端处理超时进行警告的,在beforeFilter中会启动一个定时器,在afterFilter中清除。 如果在其定时器时间内,afterFilter被调用,定时器将会被清除,因此不会出现超时警告。 如果定时器超时时,afterFilter还没有执行到,则会引发超时警告,并记录日志。 默认的处理超时是3秒,可以在加载timeout的时候作为参数传入。
Implements:

Methods

after(err, msg, session, resp, next)

After filter
Parameters:
Name Type Description
err object
msg object
session object
resp object
next function
Implements:

before(msg, session, next)

Before filter
Parameters:
Name Type Description
msg object message
session object
next function callback Function
Implements: