D++ (DPP)
C++ Discord API Bot Library
dpp::request_queue Class Reference

The request_queue class manages rate limits and marshalls HTTP requests that have been built as http_request objects. More...

#include <queues.h>

Public Member Functions

 request_queue (class cluster *owner)
 
 ~request_queue ()
 Destroy the request queue object. Side effects: Joins and deletes queue threads. More...
 
void post_request (http_request *req)
 Put a http_request into the request queue. You should ALWAYS "new" an object to pass to here – don't submit an object that's on the stack! More...
 

Detailed Description

The request_queue class manages rate limits and marshalls HTTP requests that have been built as http_request objects.

It ensures asynchronous delivery of events and queueing of requests.

It will spawn two threads, one to make outbound HTTP requests and push the returned results into a queue, and the second to call the callback methods with these results. They are separated so that if the user decides to take a long time processing a reply in their callback it won't affect when other requests are sent, and if a HTTP request takes a long time due to latency, it won't hold up user processing.

There are usually two request_queue objects in each dpp::cluster, one of which is used internally for the various REST methods to Discord such as sending messages, and the other used to support user REST calls via dpp::cluster::request().

Constructor & Destructor Documentation

◆ request_queue()

dpp::request_queue::request_queue ( class cluster owner)

Constructor

Parameters
ownerThe creating cluster. Side effects: Creates two threads for the queue

◆ ~request_queue()

dpp::request_queue::~request_queue ( )

Destroy the request queue object. Side effects: Joins and deletes queue threads.

Member Function Documentation

◆ post_request()

void dpp::request_queue::post_request ( http_request req)

Put a http_request into the request queue. You should ALWAYS "new" an object to pass to here – don't submit an object that's on the stack!

Parameters
reqrequest to add
D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0