Browse Source

Caching the campaign for those that are launched immediately. This is related to #1726

pull/1813/head
Jordan Wright 1 year ago
parent
commit
138b486b2f
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      worker/worker.go

+ 6
- 1
worker/worker.go View File

@ -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

Loading…
Cancel
Save