Skip to content

Commit

Permalink
Merge pull request #4426 from GSA/increase-idle-time
Browse files Browse the repository at this point in the history
Increases idle time from 15 to 40 min:
  • Loading branch information
FuhuXia committed Aug 21, 2023
2 parents 429e703 + 5d1b44a commit d39474f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/check-and-renew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function check_running_job {
# First we check if any instance CPU is busy
instances=$(cf app "$app_to_check" | grep '^instances:' | sed 's/.*\///')
cf app "$app_to_check" | tail -n "$instances" | awk '{ split($4,cpu,"."); print cpu[1]}' | while read -r cpu ; do
if [[ $cpu > 1 ]]; then
if [[ $cpu -gt 1 ]]; then
echo "CPU is busy! Not going to restart"
ok_to_restart="NO"
else
Expand All @@ -93,9 +93,9 @@ function check_running_job {

# Check the age of the last log
# If there are only two lines, there are no logs
if [[ $ok_to_restart == "YES" && $((`log_count` > 2)) == '1' ]]; then
# if the timestamp is younger than 15 mins from start of script
if [[ $((current_time - `log_last_time` < 900)) == '1' ]]; then
if [[ $ok_to_restart == "YES" && $(($(log_count) > 2)) == '1' ]]; then
# if the timestamp is younger than 40 mins from start of script
if [[ $((current_time - $(log_last_time) < 2400)) == '1' ]]; then
echo "Logs are too new! Not going to restart"
ok_to_restart="NO"
else
Expand Down

0 comments on commit d39474f

Please sign in to comment.