Skip to content

Commit

Permalink
Merge pull request #537 from geoadmin/fix_address_rotation_issue
Browse files Browse the repository at this point in the history
Fix address rotation issue
  • Loading branch information
ltclm authored Sep 26, 2022
2 parents 873d69a + 82415bb commit 02dd708
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scripts/index-sync-rotate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,13 @@ for sphinx_index in ${SPHINX_INDEXES[@]}; do
tmp_array=()

while IFS= read -r -d '' new_file; do
echo "copy new file: $new_file" | json_logger INFO
new_file=$(basename "${new_file}")
# shellcheck disable=2001
new_file_renamed=$(sed 's/\.sp\(\w\)$/.new.sp\1/' <<< "${new_file}")
cp -fa "${SPHINX_EFS}${new_file}" "${SPHINX_VOLUME}${new_file_renamed}"
tmp_array+=("${new_file_renamed}")
done < <(find "${SPHINX_EFS}" -name "${sphinx_index}*" -print0)
done < <(find "${SPHINX_EFS}" -name "${sphinx_index}.*" -print0)

if ((${#tmp_array[@]})); then
# remove blank strings from array
Expand All @@ -158,11 +159,14 @@ for sphinx_index in ${SPHINX_INDEXES[@]}; do
all_files_are_gone=false
while ! ${all_files_are_gone}; do
all_files_are_gone=true
echo "about to rotate ${sphinx_index}, waiting for ${new_files_merged[*]} to disappear" | json_logger INFO
for new_file in ${new_files_merged[@]}; do
# skip empty elements
[[ -z ${new_file} ]] && continue
[ -f "${SPHINX_VOLUME}${new_file}" ] && all_files_are_gone=false
done
# shellcheck disable=SC2046
${all_files_are_gone} || echo "still exist:" $( cd "${SPHINX_VOLUME}"; ls "${new_files_merged[@]}" 2> /dev/null ) | json_logger INFO
sleep 5
done
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/pg2sphinx_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def pg_get_tables(sql_query, sql_db):
t.append(sql_db + '.' + table_i)
t = list(set(t)) # get rid of duplicate entries in the list and sorting
return ','.join(sorted(t))
except psycopg2.OperationalError as err:
except (psycopg2.ProgrammingError, psycopg2.OperationalError) as err:
sys.stderr.write(
f"ERROR: wrong query detected in database: {sql_query}"\
f"\nquery:\n{sql_query}\nerror:\n{err}\n"
Expand Down

0 comments on commit 02dd708

Please sign in to comment.