Skip to content

The off-topic channel name updating task fails on non-success API response #442

@SebastiaanZ

Description

@SebastiaanZ

The background task we create to update off-topic names at midnight UTC fails if it receives a non-success API response. The reason is that our bot.api_client will raise the bot.api.ResponseCodeError exception on non-success response status codes. This means that the off-topic channel names won't be updated again until either the bot is restarted or the task is started manually again by an admin.

The relevant lines of code:

channel_0_name, channel_1_name, channel_2_name = await bot.api_client.get(
'bot/off-topic-channel-names', params={'random_items': 3}
)

To handle it, we could simply include a try-except block and log the exception in the except block. I'm not sure if we want to log the entire exception, since the exception text could be a massive HTML-response generated by cloudflare. Logging the failure with the response code should generally give us enough to determine the cause of the failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions