Skip to content

Conversation

@Th3Dilli
Copy link
Member

Adds option to set discord webhooks to get notified for the following
Follow Webhook:

  • send a notification on new releases of the following mods
    image

Mention Webhook

  • send a notification when a new comment is made on your own mods
  • send a notification for mentions
    image

@tyronx tyronx self-requested a review October 19, 2023 07:47
if(!empty($webhookurl))
{
sendWebhook($webhookdata ,$webhookurl);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not scalable - A POST request like that probably takes about a second. 100 webhooks = 100 seconds delay when saving a mod. That is even ignoring webhook urls that don't respond properly. Worst case this can completely break saving due to timeouts.

Suggestion:

  1. Make a new "webhookqueue" db table, insert an entry whenever a mod gets modified / a user gets mentioned
  2. Write a "cron-processwebhookqueue.php" that iterates over these webhooks via cronjob
  3. Make sure curl POST request timeout is below 3 seconds so you don't endlessly stall the queue with a few bad webhooks
  4. A webhook url that fails to respond to the POST request some 20 times should get disabled (and the user be notified with a line of text in the accountsettings.tpl)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long term this probably also needs the capability to run multiple cron-processwebhookqueue.php in parallel

# Conflicts:
#	lib/assetimpl/releaseeditor.php
#	lib/config.php
#	lib/user.php
@Th3Dilli Th3Dilli changed the title added discord webhooks [WIP] added discord webhooks Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants