Skip to content

Commit

Permalink
update event type in normalize method
Browse files Browse the repository at this point in the history
  • Loading branch information
RoduanKD committed May 14, 2024
1 parent 1a44ec0 commit a17de14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ghost/postmark-client/lib/PostmarkClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ module.exports = class PostmarkClient {
context: response[0].Message
});
}

logging.info(JSON.stringify(response));

metrics.metric('postmark-send-mail', {
Expand Down Expand Up @@ -158,6 +157,7 @@ module.exports = class PostmarkClient {
return;
}

logging.info('[Postmark Client] Fetching events for the last 5 minutes...');
const startDate = new Date(Date.now() - 5 * 60 * 1000);
const endDate = new Date();

Expand All @@ -170,6 +170,7 @@ module.exports = class PostmarkClient {

while (totalCount > currentOffset && events.length) {
await batchHandler(events);
logging.info('[Postmark Client] Processed ' + events.length + ' events');
currentOffset += page.Opens.length;

page = await this.getEventsFromPostmark(postmarkInstance, startDate);
Expand Down Expand Up @@ -219,11 +220,11 @@ module.exports = class PostmarkClient {
normalizeEvent(event) {
return {
id: event.MessageID,
type: event.RecordType,
severity: 'not-defined',
type: 'opened',
severity: 'permanent',
recipientEmail: event.Recipient,
emailId: event.Tag.split('|')[1] ?? null,
providerId: 'not-defined',
providerId: event.MessageID,
timestamp: new Date(event.ReceivedAt),

error: null
Expand Down

0 comments on commit a17de14

Please sign in to comment.