submit method
void
submit(
- T task
Adds a task to the queue for batch processing.
The task will be processed when either:
Implementation
void submit(T task) {
_queue.add(task); // Add the task to the queue
// If we've reached batch size, process the queue
if (_queue.length >= batchSize) {
flush();
}
// If this is the first task added after the queue was processed, start the timeout
else if (_queue.length == 1) {
_startTimer();
}
}