Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchAsync ¶
func DispatchAsync( ctx context.Context, d *Dispatcher, s store.Store, webhookLog *store.WebhookLog, delayMs int, )
DispatchAsync fires a webhook in a goroutine and updates the WebhookLog. delayMs: milliseconds to wait before dispatching (0 = immediate).
The incoming ctx is detached from its parent's cancellation via context.WithoutCancel so the goroutine's DB writes and HTTP calls survive after the originating HTTP request has completed. The logger (and any trace-id) stored in ctx is preserved.
Types ¶
type AttemptEntry ¶
type DispatchResult ¶
type DispatchResult struct {
StatusCode int
Attempts int
AttemptLogs []AttemptEntry
}
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(maxAttempts int, baseDelay time.Duration) *Dispatcher
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(targetURL string, payload map[string]any) (*DispatchResult, error)
Click to show internal directories.
Click to hide internal directories.