获取应用程序时出现跑道错误

Podio error when getting apps

Error
ErrorException: array_merge(): Argument #1 is not an array in /my/server/vendor/podio/podio-php/lib/PodioObject.php:200
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'array_merge(): ...', '/my/server/...', 200, Array)
#1 /my/server/vendor/podio/podio-php/lib/PodioObject.php(200): array_merge(NULL, Array)
#2 /my/server/vendor/podio/podio-php/models/PodioApp.php(39): PodioObject::member(Object(PodioResponse))
#3 /my/path.php(413): PodioApp::get(xxxxxxx)

这似乎是跑道 PHP SDK 或跑道 API 的错误。 json_response(导致 array_merge 错误)为 null,但 http 响应为 200。我无法让它定期发生,但它在脚本上大约有 10% 的时间发生 运行ning 30~ 这些电话。我可以 运行 直接从文档中调用 GetApp 就好了。

我知道这是响应错误,因为我的脚本在每个 re运行 的不同位置中断,具体取决于哪些数据没有从 API 正确加载。

Test 1: Exception at line 344 as the result of $app1 being null

Test 2: Exception at line 814 as the result of $app3 being null

等...

这是一个未经修改的脚本,已经存在超过 6 个月,但上周某个时候停止工作。

编辑:我还确认 cURL 也会出现同样的错误,因此这不是特定于 SDK 的问题。

我们也出现了同样的间歇性错误。自推出 TLS 更改以来。

临时解决方法是将调用包装在 do while 循环中,以便在出现错误时重试。

例如

// Get item from API
$attempts = 0;
do {
    try {
        $item = PodioItem::get($itemId);
    } catch (\Exception $e) {
        $attempts++;
        Log::error("PodioItemGetFailure #" . $attempts . ". " . $e->getMessage());
        sleep(3);
        continue;
    }
    break;
} while ($attempts < 3);

这有点令人讨厌,所以希望我们能尽快解决跑道方面的问题。

这种间歇性错误不应再发生 :)
除非你的网络连接不稳定或断断续续。

无论如何,正确处理依赖于网络的调用(就像任何 Podio API 调用一样)是件好事。我只能建议所有 Podio API 调用都应该通过排队机制,如果网络不稳定或 Podio 正在维护(例如),允许重试。