Skip to content

Handle notifications dropped due to rate limiting #7

@rootslinux

Description

@rootslinux

If the notification service sends a large number of messages within a short time window, Discord will return a failure response indicating that the message was not accepted due to rate limiting, and will provide a timer in which requests will become accepted again (usually 1-2 seconds). The naive implementation of the current system does not handle failures and simply drops the message completely. This means that we could have the case where notifications are generated but never seen in Discord due to being dropped by the rate limiting response.

To fix this, we need to look at the response generated from the curl call and see if there's a failure due to rate limiting. If so, place the message on a queue and retry later once the limiting period has expired. When a new message is about to be sent, the queue should first be checked and if any messages are in the queue, add the new message to the queue instead of sending. The queue should only hold valid messages. If any other failures occur due to invalid formatting or other issues that will not automatically resolve, the message should be dropped (and possibly logged).

All of this logic should take place in notification_service.php. This is a low priority item as we don't expect rate limiting to be a problem under most circumstances. Although forums that are very active will have a higher likelihood of encountering this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions