title: Python Boto3 not receiving messages but SQS shows in flight
body: <p>I've a docker which fetches messages from a standard SQS. But most of the times, the code shows it received zero messages and exits. While the SQS console shows the messages under &quot;Messages in flight&quot;, so the messages were received by some consumer.</p>
  <p>This is my docker entry point</p>
  <pre><code>ENV PYTHONPATH=&quot;$PYTHONPATH:/app&quot;
  
  ENTRYPOINT [ &quot;python3&quot; ]
  CMD [&quot;multi.py&quot;]
  </code></pre>
  <p>This is multi.py code</p>
  <pre><code>import multiprocessing as mp
  import subprocess
  
  def s():
      subprocess.call(['python3', 'script.py'])
  
  n_process = min(mp.cpu_count(), 8)
  process = []
  
  for i in range(n_process):
      p = mp.Process(target=s)
      process.append(p)
      p.start()
  
  for p in process:
      p.join()
  </code></pre>
  <p>This is script.py part of the code which calls receive_messages</p>
  <pre><code>sqs = boto3.resource('sqs', region_name=REGION, aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
  queue = sqs.get_queue_by_name(QueueName=QUEUE_NAME)
  
  def main():
      while True:
          m = queue.receive_messages()
          for message in m:
              process_message(message)
              message.delete()
  </code></pre>
  <p>Also, the docker works like 60% of the time. But I'm trying to figure out why it fails.</p>
  <p>PS: Solved
  This is from the boto3 docs</p>
  <blockquote>
  <p>Short poll is the default behavior where a weighted random set of machines is sampled on a ReceiveMessage call. Thus, only the messages on the sampled machines are returned. If the number of messages in the queue is extremely small, you might not receive any messages in a particular ReceiveMessage response. If this happens, repeat the request.</p>
  </blockquote>