feedback

package
v3.1.11+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const APNS = "apns"

APNS string representation

View Source
const GCM = "gcm"

GCM string representation

Variables

This section is empty.

Functions

func WaitTimeout

func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool

WaitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out. got from http://stackoverflow.com/a/32843750/3987733

Types

type Handler

type Handler struct {
	Config *viper.Viper

	FeedbackCache map[string]map[string]int
	FlushInterval time.Duration
	MarathonDB    *extensions.PGClient
	Logger        zap.Logger
	// contains filtered or unexported fields
}

Handler is a feedback handler

func NewHandler

func NewHandler(config *viper.Viper, logger zap.Logger, pendingMessagesWG *sync.WaitGroup, DBOrNil ...*extensions.PGClient) (*Handler, error)

NewHandler creates a new instance of feedback.Handler

func (*Handler) HandleMessages

func (h *Handler) HandleMessages(msgChan *chan []byte)

HandleMessages get messages from msgChan

type Listener

type Listener struct {
	Config     *viper.Viper
	ConfigFile string

	Queue                   interfaces.Queue
	Logger                  zap.Logger
	FeedbackHandler         *Handler
	GracefulShutdownTimeout int
	// contains filtered or unexported fields
}

Listener will consume push feedbacks from a queue and update job feedbacks column

func NewListener

func NewListener(configFile string, logger zap.Logger) (*Listener, error)

NewListener creates and return a new instance of feedback.Listener

func (*Listener) Start

func (l *Listener) Start()

Start starts the listener

type Message

type Message struct {
	From             string                 `json:"from"`
	MessageID        string                 `json:"message_id"`
	MessageType      string                 `json:"message_type"`
	Error            string                 `json:"error"`
	ErrorDescription string                 `json:"error_description"`
	DeviceToken      string                 `json:"DeviceToken"`
	ID               string                 `json:"id"`
	Err              map[string]interface{} `json:"Err"`
	Metadata         map[string]interface{} `json:"metadata"`
}

Message is a struct that will decode a apns or gcm feedback message

Jump to

Keyboard shortcuts

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