未验证 提交 d5c456bc 编写于 作者: Q qkqpttgf 提交者: GitHub

try fix activityLimitReached

上级 7b51e773
......@@ -514,11 +514,11 @@ class Onedrive {
}
$api = $this->api_url . '/sites/root';
$arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ]);
$arr = $this->MSAPI('GET', $api);
$Tenant = json_decode($arr['body'], true)['webUrl'];
$api = $this->api_url . '/me/followedSites';
$arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ]);
$arr = $this->MSAPI('GET', $api);
if (!($arr['stat']==200||$arr['stat']==403||$arr['stat']==400||$arr['stat']==404)) return message($arr['stat'] . json_encode(json_decode($arr['body']), JSON_PRETTY_PRINT), 'Get followedSites', $arr['stat']);
error_log1($arr['body']);
$sites = json_decode($arr['body'], true)['value'];
......@@ -812,7 +812,7 @@ class Onedrive {
$i=0;
$response = [];
while ($url!=''&&$response['stat']!=200&&$i<4) {
$response = curl('GET', $url, false, ['Authorization' => 'Bearer ' . $this->access_token]);
$response = $this->MSAPI('GET', $url);
$i++;
}
if ($response['stat']!=200) {
......@@ -990,7 +990,11 @@ class Onedrive {
if ($response['stat']==429) {
$res = json_decode($response['body'], true);
$retryAfter = $res['error']['retryAfterSeconds'];
setConfig(['activeLimit' => time()+$retryAfter], $this->disktag);
$retryAfter_n = (int)$retryAfter;
if ($retryAfter_n>0) {
$tmp1['activeLimit'] = $retryAfter_n + time();
setConfig($tmp1, $this->disktag);
}
}
curl_close($ch);
error_log1($response['stat'].'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册