antonmedv / finder

CSS Selector Generator 🗺
MIT License
1.36k stars 96 forks source link

Check num combinations aginst threshold before generating paths #84

Open Dogfalo opened 2 months ago

Dogfalo commented 2 months ago

Check Number of Combinations Against Threshold Before Generating Paths

Summary

This pull request adds a safeguard against potential memory exhaustion in the findUniquePath function by checking the total number of possible combinations before generating them.

Description

In the findUniquePath function, generating combinations of paths can lead to high memory usage if the number of combinations is large.

This update introduces a check that calculates the total number of combinations before proceeding to generate the combinations. If the number of combinations exceeds the configured threshold, the function will return a fallback path (if provided) or null.

Changes Made