# SHOPWARE 6  Error: Maximum execution time of 0 seconds exceeded when updating an order

**URL:** <https://forum.shopware.com/t/shopware-6-error-maximum-execution-time-of-0-seconds-exceeded-when-updating-an-order/70620>\
**Category:** Programmierung\
**Created:** [3. November 2020 um 12:52 UTC](https://forum.shopware.com/t/shopware-6-error-maximum-execution-time-of-0-seconds-exceeded-when-updating-an-order/70620 "2020-11-03T12:52:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meesKRS](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meesKRS](https://forum.shopware.com/u/meesKRS)\
**Post date:** [3. November 2020 um 12:52 UTC](https://forum.shopware.com/t/shopware-6-error-maximum-execution-time-of-0-seconds-exceeded-when-updating-an-order/70620/1 "2020-11-03T12:52:59Z")

</div>

Can’t update an order customFields in my subscriber listening to OrderEvents::ORDER\_WRITTEN\_EVENT

```
OrderEvents::ORDER_WRITTEN_EVENT => 'onOrderSaved',

```

here is my callback function onOrderSaved

```
public function onOrderSaved(EntityWrittenEvent $event)
    {
        $session = new Session();
        $shop = $session->get('pickup-location');
        $results = $event->getWriteResults();
        $payloads = [];
        foreach($results as $result){
            $payload = $result->getPayload();
            $payload["customFields"] = ["shop" => $shop];
            $payloads[] = $payload;
        }
        $this->orderRepository->upsert([$payload], Context::createDefaultContext());

        dd("done");
    }

```

&nbsp;

if i will dump the variable

```
$payloads

```

it’s all okay, no error happened. but when i try to update the order&nbsp;by using the following line

```
$this->orderRepository->upsert($payloads, Context::createDefaultContext());

```

&nbsp;or

```
$this->orderRepository->update($payloads, Context::createDefaultContext());

```

it will give me an error maximum\_execution\_time of 0 excited.

I can’t find where it is going into an infinite loop or something like that because the `$event-\>getWriteResults()` only got 1 occurence.

so something is going wrong in the core repository orders in shopware 6.

&nbsp;

btw here is my service in services.xml

and my constructor

```
/**
     * @var SystemConfigService
     */
    private $systemConfigService;

    /**
     * @var EntityRepositoryInterface
     */
    private $krsShopsRepository;

    /**
     * @var EntityRepositoryInterface
     */
    private $orderRepository;

    /**
     * @var EntityRepositoryInterface
     */
    private $orderToShopsRepository;

    public function __construct(
        SystemConfigService $systemConfigService,
        EntityRepositoryInterface $krsShopsRepository,
        EntityRepositoryInterface $orderRepository
    )
    {
        $this->systemConfigService = $systemConfigService;
        $this->krsShopsRepository = $krsShopsRepository;
        $this->orderRepository = $orderRepository;
    }

```

&nbsp;

&nbsp;

and here is a screenshot of the error, replace the 60 with 0 in the error below, thats my error

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/f/f70ae80af23aca6e6b3c00fa4ad8cb2ff72caf32.png)

&nbsp;

I personally dont think that editing my php.ini and set max\_execution\_time works, because i need to wait almost 200 seconds before error pop up.

Way too long for just editing a order right?

&nbsp;

I can’t find what to do anymore. Is there al possible workaround? A good&nbsp;one…

or is it a bug in Shopware and do i need to wait for the fix?
