MCPcopy
hub / github.com/knadh/listmonk / initCampaignManager

Function initCampaignManager

cmd/init.go:591–625  ·  view source on GitHub ↗

initCampaignManager initializes the campaign manager.

(msgrs []manager.Messenger, q *models.Queries, u *UrlConfig, co *core.Core, md media.Store, i *i18n.I18n, ko *koanf.Koanf)

Source from the content-addressed store, hash-verified

589
590// initCampaignManager initializes the campaign manager.
591func initCampaignManager(msgrs []manager.Messenger, q *models.Queries, u *UrlConfig, co *core.Core, md media.Store, i *i18n.I18n, ko *koanf.Koanf) *manager.Manager {
592 if ko.Bool("passive") {
593 lo.Println("running in passive mode. won't process campaigns.")
594 }
595
596 mgr := manager.New(manager.Config{
597 BatchSize: ko.Int("app.batch_size"),
598 Concurrency: ko.Int("app.concurrency"),
599 MessageRate: ko.Int("app.message_rate"),
600 MaxSendErrors: ko.Int("app.max_send_errors"),
601 FromEmail: ko.String("app.from_email"),
602 IndividualTracking: ko.Bool("privacy.individual_tracking"),
603 DisableTracking: ko.Bool("privacy.disable_tracking"),
604 UnsubURL: u.UnsubURL,
605 OptinURL: u.OptinURL,
606 LinkTrackURL: u.LinkTrackURL,
607 ViewTrackURL: u.ViewTrackURL,
608 MessageURL: u.MessageURL,
609 ArchiveURL: u.ArchiveURL,
610 RootURL: u.RootURL,
611 UnsubHeader: ko.Bool("privacy.unsubscribe_header"),
612 SlidingWindow: ko.Bool("app.message_sliding_window"),
613 SlidingWindowDuration: ko.Duration("app.message_sliding_window_duration"),
614 SlidingWindowRate: ko.Int("app.message_sliding_window_rate"),
615 ScanInterval: time.Second * 5,
616 ScanCampaigns: !ko.Bool("passive"),
617 }, newManagerStore(q, co, md), i, lo)
618
619 // Attach all messengers to the campaign manager.
620 for _, m := range msgrs {
621 mgr.AddMessenger(m)
622 }
623
624 return mgr
625}
626
627// initTxTemplates initializes and compiles the transactional templates and caches them in-memory.
628func initTxTemplates(m *manager.Manager, co *core.Core) {

Callers 1

mainFunction · 0.85

Calls 3

NewFunction · 0.92
newManagerStoreFunction · 0.85
AddMessengerMethod · 0.80

Tested by

no test coverage detected