Skip to content

Conversation

@HecFranco
Copy link
Contributor

🎯 Purpose

This PR fixes a race condition in cache directory creation that caused Warning: mkdir(): File exists errors, and includes minor improvements to Docker Compose configuration and .gitignore.

🔧 Changes

Fix Race Condition in Cache Directory Creation

  • Fixed CleanTranslationCacheListener::isCacheExpired() method to handle concurrent directory creation
  • Resolves Warning: mkdir(): File exists error that occurred when multiple processes tried to create the cache directory simultaneously
  • Method now uses a safe pattern that:
    • Checks if directory exists
    • Attempts to create it with recursive mode (mkdir($cache_dir, 0777, true))
    • Re-checks if directory exists (in case another process created it)
    • Throws RuntimeException only if the directory truly cannot be created
  • This prevents race condition warnings while ensuring proper error handling

Docker Compose Configuration

  • Removed deprecated version: '3.8' declaration from docker-compose.yml
  • Docker Compose v2+ no longer requires version declaration
  • Streamlines configuration without affecting functionality

Gitignore Updates

  • Added .docs and .demo directories to .gitignore
  • Prevents tracking of documentation and demo files in the repository

✅ Testing

  • No more Warning: mkdir(): File exists errors
  • Cache directory creation works correctly in concurrent scenarios
  • Proper error handling when directory cannot be created
  • Docker Compose configuration works as expected

📝 Breaking Changes

None - This PR is fully backward compatible.

🔗 Related Issues

Fixes:

  • Warning: mkdir(): File exists error in CleanTranslationCacheListener::isCacheExpired() when multiple processes access the cache directory simultaneously

📚 Documentation

  • Improved error handling in cache directory creation
  • Docker Compose configuration updated to modern standards
  • No user-facing changes required

- Removed the version declaration from the docker-compose.yml file to streamline the configuration. This change does not affect the functionality of the services defined in the file.
- Added .docs and .demo to the .gitignore file to prevent tracking of documentation and demo files in the repository.
- Enhanced the directory creation logic to throw a RuntimeException if the cache directory cannot be created, ensuring better error handling and robustness in the CleanTranslationCacheListener class.
- Refactored grid initialization to ensure it runs after the DOM is fully loaded, with a small delay for better reliability.
- Implemented URL filter parsing from both query strings and hash fragments, allowing for dynamic filter application on the grid.
- Added functionality to update the URL with current filter values without reloading the page, improving user experience.
- Updated links in the overview template to maintain locale context when navigating to the translation grid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant