title: python global variable in fastApi not working as normal
body: <p>I have a simple fastApi demo app which achieve a function:
  get different response json by calling a post api named changeResponse.
  The changeResponse api just changed a global variable, another api return different response through the same global variable.On local env,it works correctly, but the response always changed after i just call changeResponse once when i build this on docker.The code is as follows:</p>
  <pre><code>from typing import Optional
  from fastapi import FastAPI
  from util import read_json
  import enum
  
  app = FastAPI()
  
  type = &quot;00&quot;
      
  @app.post(&quot;/changeResponse&quot;)
  async def handle_change_download_response(param:Optional[str]):
          global type
          type = param
          print(&quot;type is &quot;+type)
          return {&quot;success&quot;:&quot;true&quot;}
  
  @app.post(&quot;/download&quot;)
  async def handle_download(param:Optional[str]):
      print(&quot;get download param: &quot;+param)
      if legalDownload(param):
          print(&quot;type is &quot;+type)
          return read_json.readDownloadSuccessRes(type)
      else:
          return read_json.readDownloadFailRes()
  
  def legalDownload(data:str)-&gt;bool:
      return True
  </code></pre>
  <p>the dockerfile is as follows:</p>
  <pre><code>FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
  
  COPY ./app /app
  </code></pre>
  <p>what i except:
  call changeResponse param is 7, get response for 7,
  call changeResponse param is 8, get response for 8.
  what i get:
  call changeResponse param is 7,get reponse for 7,call changeReponse 8, sometime the response is 7, sometime is 8,impossible to predict</p>