409 response is returned when uploading files through rest api using multi-threading

When using multiple threads to upload multiple files, one or some of the requests often return 409 errors.

{
  "message": "is at d5ed45d1f58043018814307d30567b1622996d75 but expected d608bd4cb511753f47ac90f0f8c626221c6386a4",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"
}

How to avoid this problem?