MCPcopy Index your code
hub / github.com/devaccuracy/ledgerforge / ProcessWebhook

Method ProcessWebhook

webhooks.go:162–181  ·  view source on GitHub ↗

ProcessWebhook processes a webhook notification task from the queue. Parameters: - _ context.Context: The context for the operation. - task *asynq.Task: The task containing the webhook notification data. Returns: - error: An error if the webhook processing fails.

(_ context.Context, task *asynq.Task)

Source from the content-addressed store, hash-verified

160// Returns:
161// - error: An error if the webhook processing fails.
162func (b *LedgerForge) ProcessWebhook(_ context.Context, task *asynq.Task) error {
163 conf, err := config.Fetch()
164 if err != nil {
165 return err
166 }
167
168 if conf.Notification.Webhook.Url == "" {
169 return nil
170 }
171 var payload NewWebhook
172 if err := json.Unmarshal(task.Payload(), &payload); err != nil {
173 logrus.Errorf("Error unmarshaling task payload: %v", err)
174 return err
175 }
176 err = processHTTP(payload, b.httpClient)
177 if err != nil {
178 return err
179 }
180 return nil
181}

Callers

nothing calls this directly

Calls 2

FetchFunction · 0.92
processHTTPFunction · 0.85

Tested by

no test coverage detected