title: Why does adding adding ```flask_sockets.worker``` to gunicorn slow down gRPC client connection?
body: <p>I am building a flask server that connects to a background gRPC service. I planned to use gunicorn to serve the flask app. Adding a <code>flask_sockets.worker</code> is slowing it down terribly!</p>
  
  <p>Here is a minimum working example,</p>
  
  <pre><code>import grpc                                                                                                                                                            
  from flask import Flask, render_template
  app = Flask(__name__)
  
  @app.route('/')
  def index():
      data = b"Hello, World!\n"
  
      channel = grpc.insecure_channel('{0}:{1}'.format('localhost', 40051))
      try:
          grpc.channel_ready_future(channel).result(timeout=1)
          data += b"\nChannel ready"
      except grpc.FutureTimeoutError:
          data += b"\nChannel not ready"
      return data
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0', port=8000)
  </code></pre>
  
  <p>If I run the app using,</p>
  
  <pre><code>gunicorn -w 4 mwe:app -b :8000
  </code></pre>
  
  <p>everything seems to be fine. But if instead I use,</p>
  
  <pre><code>gunicorn -w 4 mwe:app -b :8000 -k flask_sockets.worker
  </code></pre>
  
  <p>the page takes forever to load. I need to use <code>flash_sockets</code> for some additional functionality. Eventually I see,</p>
  
  <pre><code>[CRITICAL] WORKER TIMEOUT (pid:17489)
  [WARNING] Worker graceful timeout (pid:17489)
  </code></pre>
  
  <p>and the page loads! How can I solve this issue?
  My environment has,</p>
  
  <pre><code>Click==7.0
  Flask==1.1.1
  Flask-Sockets==0.2.1
  gevent==1.4.0
  gevent-websocket==0.10.1
  greenlet==0.4.15
  grpcio==1.23.0
  gunicorn==19.9.0
  itsdangerous==1.1.0
  Jinja2==2.10.1
  MarkupSafe==1.1.1
  pkg-resources==0.0.0
  six==1.12.0
  Werkzeug==0.15.5
  </code></pre>