Skip to content

Commit 4b2355c

Browse files
committed
Don't eagerly restart the service when the binary hasn't changed
This will help with metrics collection as the counters won't be zeroed out as frequently.
1 parent fca3e40 commit 4b2355c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

deployment/update.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
set -euv -o pipefail
44

55
root=/home/ubuntu
6+
binary_path=$root/playground-artifacts/ui
67

78
# Get new docker images
89
$root/rust-playground/compiler/fetch.sh
910

1011
# Clean old docker images
1112
docker system prune -f || true
1213

14+
# Get the binary's hash so we know if it has changed
15+
previous_binary_hash=""
16+
if [[ -f "${binary_path}" ]]; then
17+
previous_binary_hash=$(md5sum "${binary_path}")
18+
fi
19+
1320
# Get new artifacts
1421
aws s3 sync --region=us-east-2 s3://playground-artifacts-i32 $root/playground-artifacts
1522
# These artifacts don't change names and might stay the same size
@@ -23,8 +30,10 @@ aws s3 sync \
2330
--include=build/robots.txt \
2431
--exact-timestamps \
2532
s3://playground-artifacts-i32 $root/playground-artifacts
26-
chmod +x $root/playground-artifacts/ui
33+
chmod +x "${binary_path}"
2734

2835
# Restart to get new server binary
29-
sudo service playground stop || true
30-
sudo service playground start
36+
if [[ -z "${previous_binary_hash}" ]] || ! md5sum -c <(echo "${previous_binary_hash}") --status; then
37+
sudo service playground stop || true
38+
sudo service playground start
39+
fi

0 commit comments

Comments
 (0)