Created
April 26, 2023 12:47
-
-
Save Schnouki/f2116d291b956bf9d51497031b0ae357 to your computer and use it in GitHub Desktop.
sqs-worker-pool healthcheck test scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import socket | |
import sys | |
def main(): | |
socket_path = sys.argv[1] | |
with socket.socket(socket.AF_UNIX) as s: | |
s.connect(socket_path) | |
s.sendall(b"CHECK\n") | |
resp = s.recv(1024).strip() | |
success = resp.startswith(b"OK ") | |
sys.exit(0 if success else 1) | |
if __name__ == "__main__": | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "$$ starting" | |
echo "$$ args: $@" | |
echo "$$ socket: ${HEALTHCHECK_SOCKET}" | |
sleep 10 | |
echo "$$ reporting as healthy" | |
echo "SET $$" | nc -U ${HEALTHCHECK_SOCKET} | |
while true; do | |
sleep 100 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment