Added logging to track offer redemption (#20329)
refs [ONC-56](https://linear.app/tryghost/issue/ONC-56/support-escalation-re-offers-not-tracking) Added logging to track offer redemption logic to debug issue with offer redemptions tracking incorrectly
This commit is contained in:
parent
0f283da8eb
commit
7f92777f89
@ -104,8 +104,12 @@ module.exports = class MemberRepository {
|
||||
// Only dispatch the event after the transaction has finished
|
||||
options.transacting.executionPromise.then(async () => {
|
||||
DomainEvents.dispatch(event);
|
||||
}).catch(() => {
|
||||
}).catch((err) => {
|
||||
// catches transaction errors/rollback to not dispatch event
|
||||
logging.error({
|
||||
err,
|
||||
message: `Error dispatching event ${event.constructor.name} for member ${event.data.memberId} after transaction finished`
|
||||
});
|
||||
});
|
||||
} else {
|
||||
DomainEvents.dispatch(event);
|
||||
@ -1134,6 +1138,11 @@ module.exports = class MemberRepository {
|
||||
attribution: data.attribution,
|
||||
batchId: options.batch_id
|
||||
});
|
||||
|
||||
if (offerId) {
|
||||
logging.info(`Dispatching ${event.constructor.name} for member ${member.id} with offer ${offerId}`);
|
||||
}
|
||||
|
||||
this.dispatchEvent(event, options);
|
||||
|
||||
if (getStatus(subscriptionModel) === 'active') {
|
||||
|
Loading…
Reference in New Issue
Block a user