A static class in Alta.Api.Client, Alta.Api.Client.LowLevel.
Collects small API posts and sends them in batches: entries are queued and flushed every 30 seconds or at 100 entries, grouped by URI into one JSON list per URI.
Fields
6 private and internal fields
| Member | What it is |
|---|
private static HttpClient authorizedClient | HTTP client used to send batches; set by every Enqueue call. |
private static bool isWatchingQueue | Unused flag. |
private static readonly Logger logger | Class logger. |
private const int MaxQueueEntries | Queue size (100) that triggers a flush. |
private const int MaxQueueLifetimeMs | Longest time (30000 ms) entries wait before a flush. |
private static DoubleBufferedQueue<BatchedRequestEntry> queue | The double-buffered queue holding pending entries. |
Methods
| Member | What it is |
|---|
static async void Enqueue(string uri, object data, HttpClient client) | Queues data to be posted to uri in the next batch. The last client passed is the one used for sending. |
4 private and internal methods
| Member | What it is |
|---|
private static void InitializeQueue() | Creates the double-buffered queue on first use and hooks up ProcessQueue. |
private static bool IsRequestValid(string uri, object data, HttpClient client) | Rejects (with an error log) entries with a null client, empty URI or null data. |
private static void ProcessQueue(IEnumerable<BatchedRequestEntry> queueToProcess) | Queue flush callback; starts ProcessQueueInternal without waiting for it. |
private static async Task ProcessQueueInternal(IEnumerable<BatchedRequestEntry> list) | Groups queued entries by URI and posts each group as one JSON list. |