Find config differences to do less reloads
This is not 100% fail proof , because the configuration can change and come back to the original one during the server restart but at the end of the day it's a better user experience.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
PROCESSED_TICKETS_FILE="${STATES_DIR}/processed-tickets"
|
||||
|
||||
logger_debug handle_control_change
|
||||
|
||||
update() {
|
||||
lockfile -1 -r 30 "$HANDLERS_LOCK_FILE" || exit 1
|
||||
|
||||
@@ -19,15 +21,21 @@ update() {
|
||||
|
||||
touch "${STATES_DIR}/updating"
|
||||
|
||||
logger_debug "DNSCrypt-OSXClient configuration changed"
|
||||
|
||||
updated='no'
|
||||
while :; do
|
||||
find "$TICKETS_DIR" -type f -name 'ticket-*' > "$PROCESSED_TICKETS_FILE"
|
||||
if [ ! -s "$PROCESSED_TICKETS_FILE" -a "$updated" = 'yes' ]; then
|
||||
break
|
||||
fi
|
||||
update
|
||||
logger_debug "New tickets found"
|
||||
find "$CONTROL_DIR" -type f -name '[a-zA-Z0-9]*' \! -name '*.tmp' \
|
||||
-exec md5 {} \; > "${STATES_DIR}/controls.cksum.new"
|
||||
if cmp -s "${STATES_DIR}/controls.cksum.new" "${STATES_DIR}/controls.cksum"; then
|
||||
logger_debug "Content of the controls dir actually didn't change"
|
||||
else
|
||||
update
|
||||
mv -f "${STATES_DIR}/controls.cksum.new" "${STATES_DIR}/controls.cksum"
|
||||
fi
|
||||
updated='yes'
|
||||
while read ticket_file; do
|
||||
rm -f "$ticket_file"
|
||||
|
||||
Reference in New Issue
Block a user