Skip to content

Commit 7151f8c

Browse files
committed
refactor publish to use tee
1 parent 05123e8 commit 7151f8c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ function publish() {
139139
local line
140140
TOPIC="$1"
141141
if [[ -z "$TOPIC" ]]; then
142-
debug "ATTEMPTED TO PUBLISH ON EMPTY TOPIC"
143142
return
144143
fi
145144
if [[ ! -d "pubsub/${TOPIC}" ]]; then
146-
debug "NO SUBSCRIBERS ON ${TOPIC}"
147145
return
148146
fi
149-
while IFS= read -r line; do
150-
find pubsub/"${TOPIC}" -type p \
151-
| xargs -P 4 -I {} bash -c "printf '%s\n' '$line' > {}"
152-
done
147+
TEE_ARGS=$(find pubsub/"${TOPIC}" -type p)
148+
if [[ -z "$TEE_ARGS" ]]; then
149+
return
150+
fi
151+
tee $TEE_ARGS > /dev/null
153152
}
154153

155154
event() {

0 commit comments

Comments
 (0)