Jump to content

Fundraising/Queue wrangling

From Wikitech
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

When a lot of adyen or amazon messages show up in the damaged queue with MISSING_PREDECESSOR, it's usually because they can't find matching pending queue messages. Here's how to recreate those from logs:

It was possible, but a bit tedious. Need to script out much of this:

php Maintenance/EmptyQueueToDump.php --no-ack --queue donations-damaged --outfile ~/damagedDonations.json -m 100 --config-file ~/SmashPigConfig.php  --raw
grep -o 'completion_message_id."[^"]*"[^"]\+' ~/damagedDonations.json | sed -e 's/.*astropay-/astropay-/' -e 's/.$//' > ~/missingPendingMessages

(move missingPendingMessage to log box)

zgrep -F -f ~/missingPendingMessages payments-astropay-20160[45]* > ~/missingAstroPayLogJson

then, using this raw message template as apcontainer:

raw={"headers":{"expires":"0","source_host":"something","correlation-id":"CORRID","source_enqueued_time":"1458060070","destination":"\/queue\/pending","php-message-class":"SmashPig\\CrmLink\\Messages\\DonationInterfaceMessage","source_type":"payments","priority":"4","source_version":"unknown","source_run_id":"2027","persistent":"true","source_name":"DonationInterface","gateway":"astropay","timestamp":"1458060070309"},"body":"

create a file that we can shove into the pending queue:

for corrid in `cat missingPendingMessages`
do
body=`grep $corrid missingAstroPayLogJson | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'`
echo `sed -e "s/CORRID/$corrid/" apcontainer`$escbody\"\} >> syntheticMessages.json
done

(move syntheticMessages to smashpig box)

php Maintenance/PopulateQueueFromDump.php --config-file config.php --queue pending ~/syntheticMessages.json