Add subscription API debugging

Investigating elevated sub end counts in production over time from the
subscriptions API.
This commit is contained in:
Matt Lott 2015-05-06 11:30:01 -07:00
parent 27b2b53943
commit 340713e721

View file

@ -169,6 +169,13 @@ class SubscriptionHandler extends Handler
processInvoices null, (err) =>
return @sendDatabaseError(res, err) if err
@invoices = newInvoices.concat(@invoices)
# TODO: Temporarily debugging elevated sub end counts in production over time
debugInvoiceCount = @invoices.length
@invoices = _.uniq @invoices, false, 'invoiceID'
if debugInvoiceCount isnt @invoices.length
log.debug "Analytics cached @invoices hadd duplicates: #{debugInvoiceCount} #{@invoices.length}"
subMap = {}
for invoice in @invoices
subID = invoice.subscriptionID