Browse Source

fix: [compose-core] prevent summoning each services in one go

Some requirement might solve other requests, especially the ones that
are not clear because more than one provider exist.
cache-relation
Valentin Lab 11 months ago
parent
commit
ba9c23c04d
  1. 17
      bin/compose-core

17
bin/compose-core

@ -2636,6 +2636,7 @@ get_all_relations () {
## situation is stable
if [ "${#summon[@]}" != 0 ]; then
declare -A summon_requeued=()
while [ "${#summon[@]}" != 0 ]; do
service="${summon[0]}"
relation_name="${summon[1]}"
@ -2650,9 +2651,18 @@ get_all_relations () {
fi
if [ "${#providers[@]}" -gt 1 ]; then
warn "Auto-summon ${DARKYELLOW}$service${NORMAL}" \
"--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\
"(> 1 provider). Choosing first."
if [ -z "${summon_requeued[$service/$relation_name]}" ]; then
debug "Auto-summon ${DARKYELLOW}$service${NORMAL}" \
"--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\
"(> 1 provider). Requeing."
summon+=("$service" "$relation_name" "$relation_def") ## re-queue it
summon_requeued["$service/$relation_name"]=1
continue
else
warn "Auto-summon ${DARKYELLOW}$service${NORMAL}" \
"--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\
"(> 1 provider). Choosing first."
fi
fi
ts="${providers[0]}"
@ -2669,6 +2679,7 @@ get_all_relations () {
array_read-0 services_uses < <(_get_services_uses "$ts")
services[$ts]=1
changed=1
continue 2
done
continue
fi

Loading…
Cancel
Save