Skip to content

Commit

Permalink
Enhance ack.sh script to improve logging during auto-scaling operatio…
Browse files Browse the repository at this point in the history
…ns. Updated log messages to indicate when operations are skipped due to cooldown periods and added a message for deleting expired lock files. This change improves clarity and traceability of scaling actions.
  • Loading branch information
xiagw committed Dec 27, 2024
1 parent 6b32fb7 commit 40e6e30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/aliyun/ack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,10 @@ ack_auto_scale() {
if [[ -f $lock_file ]]; then
# 检查锁文件是否过期(超过冷却时间)
if [[ $(stat -c %Y "$lock_file") -gt $(date -d "$COOLDOWN_MINUTES minutes ago" +%s) ]]; then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 另一个扩缩容进程正在运行..." >&2
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 在冷却期($COOLDOWN_MINUTES 分钟)内,跳过操作..." >&2
return 1
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 删除过期的锁文件..." >&2
# 删除过期的锁文件
rm -f "$lock_file"
fi
Expand Down

0 comments on commit 40e6e30

Please sign in to comment.