Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
336 stars 99 forks source link

Timeout Issue #213

Closed bretto36 closed 10 months ago

bretto36 commented 10 months ago

Just posting here to help others who have issues with timeouts and who are using php artisan optimize

YOu can specify config but you need to use a callable if you want to run artisan optimize at the same time.

'api_init' => ['\App\Services\ShopifyConfig', 'options'],

<?php

namespace App\Services;

class ShopifyConfig { public static function options(\Osiset\BasicShopifyAPI\Options $opts) { $ts = config('shopify-app.api_time_store'); $ls = config('shopify-app.api_limit_store'); $sd = config('shopify-app.api_deferrer');

    // Custom Guzzle options
    $opts->setGuzzleOptions(['timeout' => 30]);

    return new \Osiset\BasicShopifyAPI\BasicShopifyAPI(
        $opts,
        new $ts(),
        new $ls(),
        new $sd()
    );
}

}

Kyon147 commented 10 months ago

Thanks

usmanpakistan commented 8 months ago

@bretto36 Can you please write the complete code on how to do it. The code You have provided above has some missing braces

bretto36 commented 8 months ago

@usmanpakistan

'api_init' => ['\App\Services\ShopifyConfig', 'options'],

<?php

namespace App\Services;

class ShopifyConfig
{
    public static function options(\Osiset\BasicShopifyAPI\Options $opts)
    {
        $ts = config('shopify-app.api_time_store');
        $ls = config('shopify-app.api_limit_store');
        $sd = config('shopify-app.api_deferrer');

        // Custom Guzzle options
        $opts->setGuzzleOptions(['timeout' => 30]);

        return new \Osiset\BasicShopifyAPI\BasicShopifyAPI(
            $opts,
            new $ts(),
            new $ls(),
            new $sd()
        );
    }
}