Skip to content

Commit

Permalink
Fix race condition between close and flush in disk queue (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
aniezurawski authored Sep 18, 2023
1 parent ee0f099 commit 8fa3ebc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

### Fixes
- Fix exception handling in `ApiMethodWrapper.handle_neptune_http_errors` ([#1469](https://github.com/neptune-ai/neptune-client/pull/1469))

- Fix race condition between close and flush in disk queue ([#1470](https://github.com/neptune-ai/neptune-client/pull/1470))

## neptune 1.6.3

Expand Down
5 changes: 3 additions & 2 deletions src/neptune/internal/disk_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ def put(self, obj: T) -> int:
version = self._last_put_file.read_local() + 1
_json = json.dumps(self._serialize(obj, version))
if self._file_size + len(_json) > self._max_file_size:
self._writer.flush()
self._writer.close()
old_writer = self._writer
self._writer = open(self._get_log_file(version), "a")
old_writer.flush()
old_writer.close()
self._file_size = 0
self._write_file_version = version
self._writer.write(_json + "\n")
Expand Down

0 comments on commit 8fa3ebc

Please sign in to comment.