gocodebox / gocodebox/lifterlms

Setup webhook automatic retries

Open
#3,247 2 comments 0 reactions 2 assignees Claimed by @brianhogg View on GitHub
Type: Enhancement
Dominant language
PHP
Stars
212
Forks
140
Avg merge
2d 14h
Merged PRs (30d)
19

Description

Currently our webhooks are set to track failed attempts and automatically disable after 5 failed delivery attempts:

https://github.com/gocodebox/lifterlms-rest/blob/9215df26a9a589d5a5488f019339dd83c1b3c15d/includes/abstracts/class-llms-rest-webhook-data.php#L289-L321

This would require 5 separate deliveries for 5 events though. EG: if it's triggered during student enrollment, the webhook will disable after the 5th student fails enrollment.

This is problematic if an external application relies on webhook deliveries to maintain data integrity in the external application.

We should automatically reschedule a failed webhook delivery on a delay (5-15 minutes? Possibly it should track individual event failures and increase the delay: failure 1, wait 5 minutes, resend; failure 2 wait 30 minutes and resend; etc...)

After failure, we can check whether the webhook should be disabled and, if not, we can reschedule it using the same args passed into the `deliver()` method: https://github.com/gocodebox/lifterlms-rest/blob/6bb9b04e2d7702fda708cb9b171c166b2006a099/includes/models/class-llms-rest-webhook.php#L39

In order to best track failures for the specific event we could probably just add an extra argument to the args array:

```
$args['retry_count'] ?? 0;
++$args['retry_count;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.