def METHOD_NAME(
    session: DbSession, pending_message: PendingMessageDb
) -> None:
    """
    Schedules the next attempt time for a failed pending message.
    :param session: DB session.
    :param pending_message: Pending message to retry.
    """
    # Set the next attempt in the future, even if the message is old. The message
    # may have failed processing because of a temporary network issue or because
    # a file could not be fetched at the moment. If we scheduled the next attempt
    # relative to the last attempt time of the message, we could enter situations
    # where the message exhausts all its retries in a few seconds.
    # If other messages depend on the rescheduled message, they will also be marked
    # rescheduled, later than the message they depend on. This guarantees that messages
    # are processed in the right order while leaving enough time for the issue that
    # caused the original message to be rescheduled to get resolved.
    next_attempt = utc_now() + compute_next_retry_interval(pending_message.retries)
    set_next_retry(
        session=session, pending_message=pending_message, next_attempt=next_attempt
    )