Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ravendb/documents/bulk_insert_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,13 @@ def __init__(self, operation: BulkInsertOperation):
self.operation = operation

def store(self, key: str, name: str, attachment_bytes: bytes, content_type: Optional[str] = None):
self.operation._concurrency_check()
self.operation._end_previous_command_if_needed()
self.operation._ensure_ongoing_operation()
release_lock_callback = self.operation._concurrency_check()
try:
self.operation._end_previous_command_if_needed()
self.operation._ensure_ongoing_operation()
except Exception as e:
release_lock_callback()
raise e

try:
if not self.operation._first:
Expand Down Expand Up @@ -655,6 +659,9 @@ def store(self, key: str, name: str, attachment_bytes: bytes, content_type: Opti
except Exception as e:
self.operation._handle_errors(key, e)

finally:
release_lock_callback()

def attachments_for(self, key: str) -> BulkInsertOperation.AttachmentsBulkInsert:
if not key or key.isspace():
raise ValueError("Document id cannot be None or empty.")
Expand Down