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: add timeout feature #629

Merged
merged 2 commits into from
Feb 6, 2025
Merged

feature: add timeout feature #629

merged 2 commits into from
Feb 6, 2025

Conversation

Gemorroj
Copy link
Contributor

#620
usage (see tests/PackerTest.php testTimeoutException):

$packer = new Packer();
$packer->setTimeoutChecker(new DefaultTimeoutChecker(3.0));

for ($i = 0; $i < 100; ++$i) {
    $box = new TestBox(
        reference: 'box ' . $i,
        outerWidth: $i * 10,
        outerLength: $i * 10,
        outerDepth: $i * 10,
        emptyWeight: 1,
        innerWidth: $i * 10,
        innerLength: $i * 10,
        innerDepth: $i * 10,
        maxWeight: 10000
    );
    $packer->addBox($box);
}

$item = new TestItem(
    description: 'item 1',
    width: 100,
    length: 100,
    depth: 100,
    weight: 100,
    allowedRotation: Rotation::BestFit
);
$packer->addItem($item, 500);

// throw the TimeoutException
$packer->pack();

@Gemorroj
Copy link
Contributor Author

Gemorroj commented Feb 3, 2025

@dvdoug hi. any chanses to approve this PR?

@dvdoug
Copy link
Owner

dvdoug commented Feb 3, 2025

You've got a failing build there, I'll take a look once it's all passing 👍

@Gemorroj
Copy link
Contributor Author

Gemorroj commented Feb 3, 2025

@dvdoug
Copy link
Owner

dvdoug commented Feb 5, 2025

It's failing on the code style checker you can see also see it on the Files changed view. You can run vendor/bin/php-cs-fixer fix

@Gemorroj
Copy link
Contributor Author

Gemorroj commented Feb 6, 2025

@dvdoug ok. fixed it. sorry

@dvdoug dvdoug merged commit 2cb551c into dvdoug:master Feb 6, 2025
14 checks passed
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.

2 participants