From 8fd1355ba16370af5df412e3a6a89d172df388c9 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Mon, 20 Jan 2020 14:21:45 +0800
Subject: [PATCH] fix:timeout after setup
---
function/scf.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/function/scf.php b/function/scf.php
index 578ae21..0d1e94a 100644
--- a/function/scf.php
+++ b/function/scf.php
@@ -106,8 +106,11 @@ function get_refresh_token()
';
setConfig([ 'refresh_token' => $tmptoken ]);
savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60);
+ $trynum = 0;
+ while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
+'.++$trynum;
$str .= '
- ';
+ ';
return message($str, getconstStr('WaitJumpIndex'));
}
return message('
' . $tmp['body'] . '
', $tmp['stat']);
@@ -165,12 +168,6 @@ namespace:' . $_SERVER['namespace'] . '
$tmp['SecretKey'] = $SecretKey;
}
echo SetbaseConfig($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey);
- $trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
-'.++$trynum;
- //sleep(10);
- //$stat = json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response'];
- //echo $stat['Status'].$stat['StatusDesc'];
$response = json_decode( updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response'];
if (isset($response['Error'])) {
$html = $response['Error']['Code'] . '
@@ -309,6 +306,9 @@ function getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $Secret
function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId, $SecretKey)
{
//print_r($Envs);
+ $trynum = 0;
+ while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
+'.++$trynum;
//json_decode($a,true)['Response']['Environment']['Variables'][0]['Key']
$tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
foreach ($tmp as $tmp1) {
@@ -444,7 +444,7 @@ namespace:' . $_SERVER['namespace'] . '
$title = 'Error';
} else {
$trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
+ while( json_decode(getfunctioninfo($function_name, $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
'.++$trynum;
//sleep(3);
$html .= '';