Prevent some race condition making test fail sometime

Saving the webhook to /tmp was sometimes not finished before curl was caused,
resulting in an empty payload -> validation error
Passing via STDIN could be an alternative...
This commit is contained in:
southerntofu 2022-02-21 00:27:26 +01:00
parent 9f17e49114
commit eab07ba4d8
1 changed files with 2 additions and 0 deletions

View File

@ -23,6 +23,8 @@ function gen_webhook() {
function send_webhook {
TMPFILE="$(mktemp)"
echo -n "$2" > $TMPFILE
# To prevent race conditions where curl is started while $TMPFILE is still empty
sync
# We can make a few attempts, just in case the webserver hasn't started yet
n=0