Race condition while updating single document multiple times

Most likely the issue is with your update code.

You probably overwrite line_item1 with it old value with your update for line_item2.

You will need to share your code so that we can help.

But before posting more code or documents, please read Formatting code and log snippets in posts.