- for i, _ in self._find(table, self._format_filter({"_id": _id})):
- break
- else:
- if fail_on_empty:
- raise DbException("Not found entry with _id='{}'".format(_id), HTTPStatus.NOT_FOUND)
- return None
- self.db[table][i] = deepcopy(indata)
+ with self.lock:
+ for i, _ in self._find(table, self._format_filter({"_id": _id})):
+ break
+ else:
+ if fail_on_empty:
+ raise DbException("Not found entry with _id='{}'".format(_id), HTTPStatus.NOT_FOUND)
+ return None
+ self.db[table][i] = deepcopy(indata)