Guard bounce watcher against empty queue IDs
This commit is contained in:
parent
c027d49f43
commit
e5e70b744b
1 changed files with 5 additions and 3 deletions
|
|
@ -45,7 +45,7 @@ tail -F "$LOG" 2>/dev/null | while IFS= read -r line; do
|
|||
RCPT=$(echo "$line" | sed -n 's/.*to=<\([^>]*\)>.*/\1/p')
|
||||
|
||||
# Only report if this was a campaign email
|
||||
if [ -n "$RCPT" ] && [ -n "${CAMPAIGN_QIDS[$QID]+x}" ]; then
|
||||
if [ -n "$QID" ] && [ -n "$RCPT" ] && [ -n "${CAMPAIGN_QIDS[$QID]+x}" ]; then
|
||||
# Refresh campaign UUID periodically
|
||||
if [ -z "$CURRENT_UUID" ]; then
|
||||
CURRENT_UUID=$(get_campaign_uuid)
|
||||
|
|
@ -68,7 +68,7 @@ tail -F "$LOG" 2>/dev/null | while IFS= read -r line; do
|
|||
QID=$(echo "$line" | sed -n 's/.*postfix\/[a-z]*\[\([0-9]*\)\]: \([A-Z0-9]*\):.*/\2/p')
|
||||
RCPT=$(echo "$line" | sed -n 's/.*to=<\([^>]*\)>.*/\1/p')
|
||||
|
||||
if [ -n "$RCPT" ] && [ -n "${CAMPAIGN_QIDS[$QID]+x}" ]; then
|
||||
if [ -n "$QID" ] && [ -n "$RCPT" ] && [ -n "${CAMPAIGN_QIDS[$QID]+x}" ]; then
|
||||
if [ -z "$CURRENT_UUID" ]; then
|
||||
CURRENT_UUID=$(get_campaign_uuid)
|
||||
fi
|
||||
|
|
@ -87,7 +87,9 @@ tail -F "$LOG" 2>/dev/null | while IFS= read -r line; do
|
|||
# Clean up old QIDs when they're removed from queue
|
||||
if echo "$line" | grep -q "removed$"; then
|
||||
QID=$(echo "$line" | sed -n 's/.*postfix\/[a-z]*\[\([0-9]*\)\]: \([A-Z0-9]*\):.*/\2/p')
|
||||
unset CAMPAIGN_QIDS[$QID] 2>/dev/null
|
||||
if [ -n "$QID" ]; then
|
||||
unset CAMPAIGN_QIDS[$QID] 2>/dev/null
|
||||
fi
|
||||
# Refresh campaign UUID every 100 removed messages
|
||||
REMOVED_COUNT=$((${REMOVED_COUNT:-0} + 1))
|
||||
if [ $((REMOVED_COUNT % 100)) -eq 0 ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue