Skip to content

Commit

Permalink
fix error in boot
Browse files Browse the repository at this point in the history
  • Loading branch information
cassidycodes committed Oct 17, 2024
1 parent 58a64cc commit 4a4e3f0
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions k6/boot-servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ start_puma_server() {

echo "Installing dependencies..."
yarn install
cd graphql-api
cd graphql-api || {
echo "Could not find graphql-api" && exit 1
}
bundle install
cd ..

# Start Node.js server
echo "Starting usage-api server..."
LOG_LEVEL=$LOG_LEVEL node usage-api.js | log_with_prefix "usage-api" &

# Start first Puma server
cd graphql-api || {
echo "Could not find graphql-api" && exit 1
Expand All @@ -37,10 +41,16 @@ start_puma_server false 9292 "hive-disabled"
# Function to handle shutdown
shutdown_servers() {
echo "Received shutdown signal. Shutting down servers..."
kill $(lsof -t -i:9291)
kill $(lsof -t -i:9292)
kill $(lsof -t -i:8888)
wait

for port in 9291 9292 8888; do
pid=$(lsof -t -i:$port)
if [ -n "$pid" ]; then
kill "$pid"
else
echo "No process found on port $port"
fi
done

echo "Servers shut down gracefully."
exit 0
}
Expand Down

0 comments on commit 4a4e3f0

Please sign in to comment.