Skip to content

Commit 93bbd77

Browse files
authored
Merge pull request #20 from Geode-solutions/fix/stop_instance_after_delete
fix(cleanup): stop the instance once its service is deleted
2 parents 67defd1 + 7bf274c commit 93bbd77

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎.releaserc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
plugins: [
77
'@semantic-release/commit-analyzer',
88
'@semantic-release/release-notes-generator',
9-
'@semantic-release/github'
9+
['@semantic-release/github', { successCommentCondition: false, failCommentCondition: false }]
1010
]
1111
}

‎cleanup.bash‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,30 @@ delete_service() {
2626

2727
if [[ "$http_code" == 2* ]]; then
2828
echo "Service deletion request accepted (HTTP ${http_code})"
29+
elif [[ "$http_code" == 404 ]]; then
30+
echo "Service already deleted (HTTP ${http_code})"
2931
else
3032
echo "Delete failed (HTTP ${http_code}): $(cat /tmp/delete_response.json)"
33+
return 1
3134
fi
3235
}
3336

37+
# Once the service is deleted, the instance keeps running (and being billed) until its
38+
# open requests, like event streams, reach the request timeout: stop it right away
39+
stop_instance() {
40+
echo "Stopping instance"
41+
supervisorctl -c /etc/supervisord.conf shutdown
42+
}
43+
3444
while true; do
3545
sleep 30
3646
response=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "http://127.0.0.1/geode/health")
3747
echo "response ${response}"
3848

3949
if [ "$response" != "200" ]; then
40-
delete_service
50+
if delete_service; then
51+
stop_instance
52+
fi
4153
break
4254
fi
4355
done

‎ruff.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://docs.astral.sh/ruff/configuration/
22

3-
target-version = "py312"
3+
target-version = "py314"
44
line-length = 100
55
indent-width = 4
66
extend-exclude = ["**/schemas/**"] # generated schemas

0 commit comments

Comments
 (0)