Skip to content
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

Feature request: add max execution time #620

Open
Gemorroj opened this issue Nov 13, 2024 · 0 comments
Open

Feature request: add max execution time #620

Gemorroj opened this issue Nov 13, 2024 · 0 comments

Comments

@Gemorroj
Copy link

Gemorroj commented Nov 13, 2024

Sometimes "BoxPacker" works for a very long time and we need to force it to stop and continue working with other code.
I would like to add some kind of countdown and throw an exception when a certain limit is reached.
Something like this:

$limitSeconds = 2;


$startTime = microtime(true);
while(true) { // packing process
    sleep(1);

    $currentTime = microtime(true);
    if ($currentTime - $limitSeconds > $startTime) {
        throw new \Exception('Time Limit Exception');
    }
}
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

No branches or pull requests

1 participant