/**
  * Clear the queue of failed records based on config lifetime
  */
 protected function clearFailedQueue()
 {
     // Initialize the queue collection
     /** @var $queueCollection \ClassyLlama\AvaTax\Model\ResourceModel\Queue\Collection */
     $queueCollection = $this->queueCollectionFactory->create();
     $queueCollection->addQueueStatusFilter(Queue::QUEUE_STATUS_FAILED);
     // Get configuration for record lifetime
     $completeDays = $this->avaTaxConfig->getQueueFailedLifetime();
     // Calculate the number of seconds to adjust the filter
     // 86400 seconds == 60 seconds * 60 minutes * 24 hours == 1 day
     $secondsBeforeNow = $completeDays * 60 * 60 * 24;
     // Add filters
     $queueCollection->addCreatedAtBeforeFilter($secondsBeforeNow);
     $queueCollection->addUpdatedAtBeforeFilter($secondsBeforeNow);
     // Process each queued entity
     /** @var $queue Queue */
     foreach ($queueCollection as $queue) {
         // Remove the queue record
         $queue->delete();
         $this->deleteFailedCount++;
     }
 }