ddns-scripts: Fixup dnspod.cn-v3
authorFriesI23 Qin <FriesI23@outlook.com>
Thu, 16 Jan 2025 00:27:20 +0000 (08:27 +0800)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Wed, 22 Jan 2025 10:21:46 +0000 (11:21 +0100)
Migrate retry_count to retry_max_count in the script to fix infinite retry loop.

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/update_dnspod_cn_v3.sh

index cc8a9616eaf2a15f0c9f4e0bef1a935274f93f24..feaf8db150469c0cdf52168c5367fe362689660d 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=2.8.2
-PKG_RELEASE:=57
+PKG_RELEASE:=58
 
 PKG_LICENSE:=GPL-2.0
 
index e8dce3d586ddae36ac441fa5a9e3af18290445b2..194be28e3032e056c8dd9ee41d0a431ad4186fc8 100644 (file)
@@ -8,6 +8,9 @@
 #      - at: net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh
 # - github.com/nixonli/ddns-scripts_dnspod for "update_dnspod_cn.sh"
 #
+# v1.2.0:
+#   - Migrate retry_count to retry_max_count
+#   - Fix signature expiration during retries
 # v1.1.0: Publish script
 #
 # 2024 FriesI23 <FriesI23@outlook.com>
@@ -44,6 +47,7 @@ local __URLHOST="dnspod.tencentcloudapi.com"
 local __URLBASE="https://$__URLHOST"
 local __METHOD="POST"
 local __CONTENT_TYPE="application/json"
+local __RETRY_COUNT=${retry_count:-$retry_max_count}
 
 # Build base command to use
 local __PRGBASE="$CURL -RsS -o $DATFILE --stderr $ERRFILE"
@@ -90,11 +94,11 @@ tencentcloud_transfer() {
                }
 
                __CNT=$(($__CNT + 1)) # increment error counter
-               # if error count > retry_count leave here
-               [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] &&
-                       write_log 14 "Transfer failed after $retry_count retries"
+               # if error count > __RETRY_COUNT leave here
+               [ $__RETRY_COUNT -gt 0 -a $__CNT -gt $__RETRY_COUNT ] &&
+                       write_log 14 "Transfer failed after $__RETRY_COUNT retries"
 
-               write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
+               write_log 4 "Transfer failed - retry $__CNT/$__RETRY_COUNT in $RETRY_SECONDS seconds"
                sleep $RETRY_SECONDS &
                PID_SLEEP=$!
                wait $PID_SLEEP # enable trap-handler