mirror of https://github.com/gophish/gophish
Caching the campaign for those that are launched immediately. This is related to #1726
parent
c5c1e6ff68
commit
138b486b2f
|
@ -125,6 +125,11 @@ func (w *DefaultWorker) LaunchCampaign(c models.Campaign) {
|
||||||
// that implements an interface as a slice of that interface.
|
// that implements an interface as a slice of that interface.
|
||||||
mailEntries := []mailer.Mail{}
|
mailEntries := []mailer.Mail{}
|
||||||
currentTime := time.Now().UTC()
|
currentTime := time.Now().UTC()
|
||||||
|
campaignMailCtx, err := models.GetCampaignMailContext(c.Id, c.UserId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, m := range ms {
|
for _, m := range ms {
|
||||||
// Only send the emails scheduled to be sent for the past minute to
|
// Only send the emails scheduled to be sent for the past minute to
|
||||||
// respect the campaign scheduling options
|
// respect the campaign scheduling options
|
||||||
|
@ -132,7 +137,7 @@ func (w *DefaultWorker) LaunchCampaign(c models.Campaign) {
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err = m.CacheCampaign(&c)
|
err = m.CacheCampaign(&campaignMailCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue