Fix infinite loop in hierarchical term generation for brands - #200
Closed
layoutd wants to merge 2 commits into
Closed
Fix infinite loop in hierarchical term generation for brands#200layoutd wants to merge 2 commits into
layoutd wants to merge 2 commits into
Conversation
…p_set_object_terms() for assignment
- Added max retry limit to prevent infinite loops when generating duplicate term names - deviceManufacturer() has limited unique values, causing term_exists errors - Without retry limit, the --$i retry logic would loop forever - Now breaks after amount * 10 retries to allow for reasonable duplicate attempts Fixes test_batch_validation_max_size hanging indefinitely
layoutd
force-pushed
the
fix/pr-174-review-feedback
branch
from
February 13, 2026 21:02
ed83e0d to
330f0d1
Compare
Contributor
Author
|
Closing this PR as we've addressed the issue directly in the base branch. Instead of adding retry limits to handle deviceManufacturer()'s limited unique values (only 6), we switched to using company() which provides hundreds of unique company names. This completely avoids the duplicate term/infinite loop issue without needing additional safety logic. The fix has been incorporated into fix/pr-174-review-feedback branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes infinite loop issue in
Term::batch_hierarchical()that causedtest_batch_validation_max_sizeto hang indefinitely.Problem
deviceManufacturer()which has limited unique valuesterm_existserrors--$i) would loop forever without any exit conditionSolution
Added max retry limit to
Term::batch_hierarchical():$retry_count$amount * 10(reasonable for duplicates)Test Results
test_batch_validation_max_size: Now passes in ~2.5s (was hanging forever)Files Changed
includes/Generator/Term.php: Added retry limit logic inbatch_hierarchical()includes/Generator/Product.php: Ensured brands usemax-depth => 1to avoid hierarchy complexity