code: def process_status_queue(self):
          
          self.log.debug('Start processing status queue')
          while True:
              messages = self.status_queue.receive_messages(MaxNumberOfMessages=10)
  
              if not messages:
                  break
  
              for message in messages:
                  data = json.loads(message.body)
                  job = SchedulerJob.get(data['id'])
                  try:
                      if job and job.update_status(data['status']):
                          db.session.commit()
                  except SchedulerError as ex:
                      if hasattr(ex, 'message') and ex.message == 'Attempting to update already completed job':
                          pass
  
                  message.delete()
  
          # Close any batch that is now complete
          open_batches = db.SchedulerBatch.find(SchedulerBatch.status < SchedulerStatus.COMPLETED)
          for batch in open_batches:
              open_jobs = list(filter(lambda x: x.status < SchedulerStatus.COMPLETED, batch.jobs))
              if not open_jobs:
                  open_batches.remove(batch)
                  batch.update_status(SchedulerStatus.COMPLETED)
                  self.log.debug('Closed completed batch {}'.format(batch.batch_id))
              else:
                  started_jobs = list(filter(lambda x: x.status > SchedulerStatus.PENDING, open_jobs))
                  if batch.status == SchedulerStatus.PENDING and len(started_jobs) > 0:
                      batch.update_status(SchedulerStatus.STARTED)
                      self.log.debug('Started batch manually {}'.format(batch.batch_id))
  
          # Check for stale batches / jobs
          for batch in open_batches:
              if batch.started < datetime.now() - timedelta(hours=2):
                  self.log.warning('Closing a stale scheduler batch: {}'.format(batch.batch_id))
                  for job in batch.jobs:
                      if job.status < SchedulerStatus.COMPLETED:
                          job.update_status(SchedulerStatus.ABORTED)
                  batch.update_status(SchedulerStatus.ABORTED)
          db.session.commit()
docs: Process all messages in the `status_queue` and check for any batches that needs to change status
  
          Returns:
              `None`