Skip to content

feat: Sync revamped, faster and improved #3478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2025
Merged

feat: Sync revamped, faster and improved #3478

merged 2 commits into from
Jul 1, 2025

Conversation

ildyria
Copy link
Member

@ildyria ildyria commented Jun 22, 2025

Fixes #1370
Fixes #1493
Fixes #1238
Fixes #523 (as in we do re-import and delete the previous location)

This pull request refactors the directory import functionality by introducing a pipeline-based approach with modular processing stages. The changes aim to simplify the code, improve maintainability, and enhance functionality, such as tree-based album creation and better handling of reserved directories.

Refactoring of Exec class:

  • Replaced the monolithic Exec class with a pipeline-based architecture for processing imports, using the Illuminate\Pipeline\Pipeline class. (app/Actions/Import/Exec.php)
  • Introduced ImportDTO to encapsulate import parameters and state, replacing the use of multiple class properties. (app/Actions/Import/Exec.php)
  • Removed legacy methods like normalizePath, readLocalIgnoreList, and checkAgainstIgnoreList, delegating these responsibilities to new pipeline stages. (app/Actions/Import/Exec.php)

New pipeline stages:

  1. BuildTree:

    • Introduced the BuildTree pipeline stage to construct a tree structure of folders and files for import. (app/Actions/Import/Pipes/BuildTree.php)
    • Centralized path normalization and reserved directory checks within this stage. (app/Actions/Import/Pipes/BuildTree.php)
  2. CreateNonExistingAlbums:

    • Added the CreateNonExistingAlbums stage to create albums for folders that do not already exist in the database. (app/Actions/Import/Pipes/CreateNonExistingAlbums.php)
    • Implemented a bottom-up approach to ensure child albums are processed before their parents. (app/Actions/Import/Pipes/CreateNonExistingAlbums.php)

Improvements to reserved directory handling:

  • Consolidated reserved directory checks into a reusable folder_skip_list array in the BuildTree stage. (app/Actions/Import/Pipes/BuildTree.php)
  • Improved error handling for invalid or reserved directories. (app/Actions/Import/Pipes/BuildTree.php)

These changes significantly enhance the modularity and readability of the import process while laying the groundwork for future extensibility.

@ildyria ildyria requested a review from a team as a code owner June 22, 2025 15:15
@ildyria ildyria added the Review: medium Medium review expected: not many files, some attention to details required. label Jun 22, 2025
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 76.77419% with 72 lines in your changes missing coverage. Please review.

Project coverage is 90.69%. Comparing base (9084815) to head (55f45c4).
Report is 6 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria added the alpha-ready Branch is available in alpha label Jun 22, 2025
@ildyria ildyria merged commit 6913b52 into master Jul 1, 2025
54 of 56 checks passed
@ildyria ildyria deleted the sync-revamped branch July 1, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha-ready Branch is available in alpha Review: medium Medium review expected: not many files, some attention to details required.
Projects
None yet
2 participants