Skip to content

Add Extra Time to Builder #101

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

Open
TheBuggs opened this issue Mar 14, 2025 · 0 comments
Open

Add Extra Time to Builder #101

TheBuggs opened this issue Mar 14, 2025 · 0 comments

Comments

@TheBuggs
Copy link

I have a problem when using a package in my test environment to check all dependencies. When I have many different CSS files, the build process takes more time because the process duration, which is around 60 seconds, is not stable, causing my deployment to crash. I have added extra time (add 10 min), but can you add functionality to configure this through a config file or suggest another simple solution?

I will provide my workaround:

composer.json

    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "update-timeout": [
            "php update_timeout.php"
        ],
        "post-install-cmd": [
            "@auto-scripts",
            "@update-timeout"
        ],
        "post-update-cmd": [
            "@auto-scripts",
            "@update-timeout"
        ]
    },

update_time.php

<?php

function updateTimeout($filePath): void
{
    $fileContents = file_get_contents($filePath);

    if ($fileContents === false) {
        die("Error: Unable to read the file at $filePath");
    }

    $lines = explode(PHP_EOL, $fileContents);
    $newLines = [];
    $lineToAdd = '$process->setTimeout(600);';

    foreach ($lines as $line) {
        $newLines[] = $line;

        if (trim($line) === '$process = $binary->createProcess($arguments);') {
            $newLines[] = $lineToAdd;
        }
    }

    $updatedContents = implode(PHP_EOL, $newLines);
    $result = file_put_contents($filePath, $updatedContents);

    if ($result === false) {
        die("Error: Unable to write to the file at $filePath");
    }

    echo "Timeout added successfully in $filePath.\n";
}

$filePath = __DIR__ . '/vendor/symfonycasts/tailwind-bundle/src/TailwindBuilder.php';
updateTimeout($filePath);

Thanks a lot!

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