Problem/Motivation
The commerce_alexanders module creates API requests and if it is broken for whatever reason that's it. There is no retry or anything. See \commerce_alexanders_commerce_order_update(). It does:
$alexanders_order = AlexandersOrder::create([
'order_number' => $order->id(),
'rush' => $order->hasField('alxdr_rush') && $order->get('alxdr_rush')->value,
'standardPrintItems' => $alexanders_order_items,
'shipping' => $alexanders_shipment,
]);
$alexanders_order->save();
$api = new AlexandersApi();
$api->createOrder($alexanders_order);
And createOrder() does
$orderData = $this->buildOrderData($order);
$url = $this->generateUrl()->toString();
try {
$response = $this->client->post($url, $orderData);
}
catch (RequestException $e) {
watchdog_exception('alexanders', $e);
return FALSE;
}
return $this->processResponse($response);
So the good news is that we've logged the fail but there's no retry. Also if the Alexanders API starts to timeout this will make order updates vulnerable to PHP timeouts.
Proposed resolution
In general it is best to queue such API requests rather do them inline. Discuss the best solution.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3063011-4.patch | 9.49 KB | alexpott |
| #3 | 3063011-3.patch | 9.52 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottHere's a completely untested patch that integrates with the advancedqueue module which provides:
Comment #4
alexpottRebased on 8.x-1.x now that #3065692: Unnecessary PHP 7.1 code has landed.
Comment #5
joshmillerI'm no longer maintaining this module and am marking the project unsupported, so I'm closing its open issues. If you depend on it and want to take over maintenance, say so on the project page and I'll help hand it over.