From a4bfb032ff61be4ddb007ab5a603217c2fcd498a Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Thu, 9 Jun 2022 14:52:03 -0400 Subject: [PATCH] Make awx-autoreloader work faster for large code changes --- tools/docker-compose/awx-autoreload | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/docker-compose/awx-autoreload b/tools/docker-compose/awx-autoreload index 593f644d01..5fcbb90026 100755 --- a/tools/docker-compose/awx-autoreload +++ b/tools/docker-compose/awx-autoreload @@ -6,10 +6,15 @@ if [ $# -lt 2 ]; then exit 1 fi +last_reload=`date +%s` + inotifywait -mrq -e create,delete,attrib,close_write,move --exclude '/awx_devel/awx/ui' $1 | while read directory action file; do - if [[ "$file" =~ .*py$ ]]; then + this_reload=`date +%s` + since_last=$((this_reload-last_reload)) + if [[ "$file" =~ .*py$ ]] && [[ "$since_last" -gt 1 ]]; then echo "File changed: $file" echo "Running command: $2" eval $2 + last_reload=`date +%s` fi done