Skip to content

Commit 0d85ee3

Browse files
committed
fix: allow to delay ticket email
fixed duplicated emails Change-Id: Id8c23e496bd8350af949c5cbc70fca5678fef5db
1 parent 2e83d76 commit 0d85ee3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

app/Jobs/SendAttendeeInvitationEmail.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ public function handle
7474
}
7575

7676
$attendee = $ticket->getOwner();
77-
77+
Log::debug
78+
(
79+
sprintf
80+
(
81+
"SendAttendeeInvitationEmail::handle sendInvitationEmail to attendee %s (%s)",
82+
$attendee->getEmail(),
83+
$attendee->getId()
84+
)
85+
);
7886
$attendee->sendInvitationEmail($ticket);
7987
}
8088
catch (\Exception $ex){

app/Models/Foundation/Summit/Registration/Attendees/SummitAttendee.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ public function sendInvitationEmail
498498

499499
if ($this->isComplete()) {
500500
Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s is complete", $email));
501-
// adds a threshold of 10 minutes to avoid duplicates emails
502-
if (Cache::add(sprintf("%s_emit_ticket", $key), true, 10)) {
501+
// adds a threshold of 20 minutes to avoid duplicates emails
502+
if (Cache::add(sprintf("%s_emit_ticket", $key), true, now()->addMinutes(20))) {
503503
Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s ticket %s sending SummitAttendeeTicketEmail", $email, $ticket->getId()));
504504
SummitAttendeeTicketEmail::dispatch($ticket, $payload, $test_email_recipient);
505505
$ticket->getOwner()->markInvitationEmailSentDate();
@@ -515,8 +515,8 @@ public function sendInvitationEmail
515515
// they bought a ticket for themselves.
516516
if ($order->getOwnerEmail() !== $ticket->getOwnerEmail() || $overrideTicketOwnerIsSameAsOrderOwnerRule) {
517517
// no delay
518-
// adds a threshold of 10 minutes to avoid duplicates emails
519-
if (Cache::add(sprintf("%s_edit_ticket", $key), true, 10)) {
518+
// adds a threshold of 20 minutes to avoid duplicates emails
519+
if (Cache::add(sprintf("%s_edit_ticket", $key), true, now()->addMinutes(20))) {
520520
Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s ticket %s sending InviteAttendeeTicketEditionMail", $email, $ticket->getId()));
521521
InviteAttendeeTicketEditionMail::dispatch($ticket, $payload, $test_email_recipient);
522522
$ticket->getOwner()->markInvitationEmailSentDate();

0 commit comments

Comments
 (0)