Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIdle = fmt.Errorf("service is inactive")
ErrIdle indicates that, according to the Watcher configuration, the service is idle.
var TickInterval = 5 * time.Second
TickInterval is the interval at which to check the proxy activity.
Functions ¶
func RecordActivity ¶
func RecordActivity(id string)
RecordActivity records activity for a idler. ID must be a globally unique identifier for the idler.
func Register ¶
func Register(cfg sproto.IdleTimeoutConfig, action TimeoutFn)
Register an idler to default service. The action is called at most once when the idle timeout is exceeded. The action can trigger until Unregister is called. ID must be a globally unique identifier for the idler.
func Unregister ¶
func Unregister(id string)
Unregister removes an idler from the service. ID must be a globally unique identifier for the idler.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches the proxy activity to handle a task actor idle timeout.
func New ¶
func New(cfg sproto.IdleTimeoutConfig, action TimeoutFn) *Watcher
New creates a new idle timeout watcher. The action can be triggered until Close is called.
func (*Watcher) RecordActivity ¶
RecordActivity notes the activity to delay idle timeout.