bug fix: add timeout to curl

This commit is contained in:
Usman Nasir 2021-04-30 03:54:08 +05:00
parent e1728894fa
commit cde77fa279
4 changed files with 8 additions and 4 deletions

View File

@ -104,7 +104,7 @@ echo -e "\n${1}=${2}\n" >> /tmp/cyberpanel_debug.log
Debug_Log2() {
Check_Server_IP "$@" >/dev/null 2>&1
echo -e "\n${1}" >> /var/log/installLogs.txt
curl -d '{"ipAddress": "'"$Server_IP"'", "InstallCyberPanelStatus": "'"$1"'"}' -H "Content-Type: application/json" -X POST https://cloud.cyberpanel.net/servers/RecvData >/dev/null 2>&1
curl --max-time 20 -d '{"ipAddress": "'"$Server_IP"'", "InstallCyberPanelStatus": "'"$1"'"}' -H "Content-Type: application/json" -X POST https://cloud.cyberpanel.net/servers/RecvData >/dev/null 2>&1
}
Branch_Check() {

View File

@ -30,6 +30,6 @@ class InstallLog:
try:
finalData = json.dumps({'ipAddress': InstallLog.ServerIP, "InstallCyberPanelStatus": message})
requests.post(InstallLog.LogURL, data=finalData)
requests.post(InstallLog.LogURL, data=finalData, timeout=10)
except:
pass

View File

@ -23,8 +23,11 @@ class UpgradeCyberPanel:
def PostStatus(self, message):
finalData = json.dumps({'ipAddress': self.ipAddress, "UpgradeCyberPanelStatus": message})
resp = requests.post(UpgradeCyberPanel.LogURL, data=finalData, verify=False)
print (resp.text)
try:
resp = requests.post(UpgradeCyberPanel.LogURL, data=finalData, verify=False, timeout=10)
except:
pass
def RestoreOldCP(self):

View File

@ -2596,6 +2596,7 @@ vmail
Upgrade.stdOut("Upgrade Completed.")
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('branch', help='Install from branch name.')