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)
| 160 | // Returns: |
| 161 | // - error: An error if the webhook processing fails. |
| 162 | func (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 | } |
nothing calls this directly
no test coverage detected