when select task by id, the database lock the record. if other one to do same time the second one will get the “Task is already claimed or completed”
We use transaction.atomic()
as a context manager to ensure that all database operations within the block are atomic, meaning they are either all committed or all rolled back in case of an error.