Skip to content

Commit

Permalink
Merge pull request #2165 from zerotier/network-check
Browse files Browse the repository at this point in the history
check hooks are enabled before firing
  • Loading branch information
glimberg authored Nov 20, 2023
2 parents a477688 + d37dce5 commit 663ed73
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 15 additions & 1 deletion controller/PostgreSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,21 @@ void PostgreSQL::commitThread()
w.commit();

if (_smee != NULL && isNewMember) {
notifyNewMember(networkId, memberId);
pqxx::row row = w.exec_params1(
"SELECT "
" count(h.hook_id) "
"FROM "
" ztc_hook h "
" INNER JOIN ztc_org o ON o.org_id = h.org_id "
" INNER JOIN ztc_network n ON n.owner_id = o.owner_id "
" WHERE "
"n.id = $1 ",
networkId
);
int64_t hookCount = row[0].as<int64_t>();
if (hookCount > 0) {
notifyNewMember(networkId, memberId);
}
}

const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL);
Expand Down
14 changes: 8 additions & 6 deletions ext/central-controller-docker/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ else
done
fi

echo "Waiting for temporal"
while ! nc -z ${ZT_TEMPORAL_HOST} ${ZT_TEMPORAL_PORT}; do
echo "waiting...";
sleep 1;
done
echo "Temporal is up"
if [ -n "$ZT_TEMPORAL_HOST" ] && [ -n "$ZT_TEMPORAL_PORT" ]; then
echo "waiting for temporal..."
while ! nc -z ${ZT_TEMPORAL_HOST} ${ZT_TEMPORAL_PORT}; do
echo "waiting...";
sleep 1;
done
echo "Temporal is up"
fi

export GLIBCXX_FORCE_NEW=1
export GLIBCPP_FORCE_NEW=1
Expand Down

0 comments on commit 663ed73

Please sign in to comment.