Skip to content

Conversation

@IvanMurzak
Copy link
Owner

Refactored BufferedFileLogStorage and FileLogStorage to use a simple object lock (_fileMutex) instead of SemaphoreSlim for synchronizing file access. This simplifies thread safety and removes unnecessary async/await patterns for file operations, improving maintainability.

Refactored BufferedFileLogStorage and FileLogStorage to use a simple object lock (_fileMutex) instead of SemaphoreSlim for synchronizing file access. This simplifies thread safety and removes unnecessary async/await patterns for file operations, improving maintainability.
@IvanMurzak IvanMurzak self-assigned this Jan 27, 2026
@IvanMurzak IvanMurzak added the bug Something isn't working label Jan 27, 2026
Copilot AI review requested due to automatic review settings January 27, 2026 03:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Unity log file storage synchronization by replacing SemaphoreSlim with a simple lock/mutex object to coordinate file access, aiming to simplify thread safety and reduce async complexity.

Changes:

  • Replaced _fileLock (SemaphoreSlim) with _fileMutex (object) and converted critical sections to lock blocks.
  • Updated Flush, Append, Clear, and Query paths to use the new lock-based synchronization.
  • Refactored async variants (FlushAsync, AppendAsync) to remove WaitAsync patterns and adjust execution strategy.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Unity-MCP-Plugin/Assets/root/Runtime/Unity/Logs/FileLogStorage.cs Replaces semaphore-based synchronization with lock and refactors async methods accordingly.
Unity-MCP-Plugin/Assets/root/Runtime/Unity/Logs/BufferedFileLogStorage.cs Updates buffered flush/clear/query synchronization to use the base class mutex and changes FlushAsync behavior.

@IvanMurzak IvanMurzak merged commit 1496aa8 into main Jan 27, 2026
31 checks passed
@IvanMurzak IvanMurzak deleted the fix/unity-domain-reload-freeze branch January 27, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants