ping

package module
v1.1.52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ping

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRetry = fmt.Errorf("retry")

Functions

func CtxLogger

func CtxLogger(ctx context.Context) *logrus.Entry

func GetLogger

func GetLogger() *logrus.Logger

Types

type Event

type Event struct {
	//Id         string `json:"id"`
	Uid        string `json:"uid"`
	RetryCount int    `json:"retryCount"`
}

func (*Event) Marshall

func (e *Event) Marshall() []byte

type Option

type Option struct {
	Prefix     string
	OfflineTTL int64
}

type Service

type Service struct {
	Prefix string
	// contains filtered or unexported fields
}

func NewService

func NewService(redisClient redis.UniversalClient, opt *Option) *Service

func (*Service) Ping

func (s *Service) Ping(ctx context.Context, uid string) error

心跳队列的成员就是 uid:同一个 uid 永远只有一条,每次心跳刷新它的分数。 早期版本把 Event(json, 含 retryCount) 当成员,重试路径会为同一个 uid 追加 retryCount 不同的副本,副本的分数不会被真实心跳刷新,老化后就把还在心跳的 uid 判成下线(调用方表现为健康连接被踢、客户端重连抖动)。

func (*Service) PingMulti added in v1.1.52

func (s *Service) PingMulti(ctx context.Context, uidL []string) error

func (*Service) RegisterOfflineHandle added in v1.1.48

func (s *Service) RegisterOfflineHandle(f func(uid string) error)

func (*Service) StartTick

func (s *Service) StartTick()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址