diff --git a/worker/worker.go b/worker/worker.go index c4f2f1f0..76603edf 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -125,6 +125,11 @@ func (w *DefaultWorker) LaunchCampaign(c models.Campaign) { // that implements an interface as a slice of that interface. mailEntries := []mailer.Mail{} currentTime := time.Now().UTC() + campaignMailCtx, err := models.GetCampaignMailContext(c.Id, c.UserId) + if err != nil { + log.Error(err) + return + } for _, m := range ms { // Only send the emails scheduled to be sent for the past minute to // respect the campaign scheduling options @@ -132,7 +137,7 @@ func (w *DefaultWorker) LaunchCampaign(c models.Campaign) { m.Unlock() continue } - err = m.CacheCampaign(&c) + err = m.CacheCampaign(&campaignMailCtx) if err != nil { log.Error(err) return