ping: fix healthCheck panic
This commit is contained in:
parent
ff4941daa4
commit
dbd8e28fc8
1 changed files with 8 additions and 3 deletions
|
|
@ -30,11 +30,16 @@ type DirectRouteMapping struct {
|
|||
|
||||
func NewDirectRouteMapping(timeout time.Duration) *DirectRouteMapping {
|
||||
mapping := common.Must1(freelru.NewSharded[DirectRouteSession, DirectRouteDestination](1024, maphash.NewHasher[DirectRouteSession]().Hash32))
|
||||
mapping.SetHealthCheck(func(session DirectRouteSession, destination DirectRouteDestination) bool {
|
||||
return !destination.IsClosed()
|
||||
mapping.SetHealthCheck(func(session DirectRouteSession, action DirectRouteDestination) bool {
|
||||
if action != nil {
|
||||
return !action.IsClosed()
|
||||
}
|
||||
return true
|
||||
})
|
||||
mapping.SetOnEvict(func(session DirectRouteSession, action DirectRouteDestination) {
|
||||
action.Close()
|
||||
if action != nil {
|
||||
action.Close()
|
||||
}
|
||||
})
|
||||
mapping.SetLifetime(timeout)
|
||||
return &DirectRouteMapping{mapping, timeout}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue