feat(notifications): send product notifications with a rights check right before each send
This commit is contained in:
1 parent
a856066316
commit
623d41b969
59 files changed
+4125
-1126
No files matched your search
@@ -51,6 +51,10 @@ type Application struct {
|
||||
// the servers run. It is nil with EMAIL_PROVIDER=disabled or when the
|
||||
// database is not configured.
|
||||
mailSending *mailsender.Worker
|
||||
// notificationSending sends the stored product notifications while the
|
||||
// servers run, after their rights checks. It is nil under the same
|
||||
// conditions as mailSending.
|
||||
notificationSending *notificationSendingWorker
|
||||
// deliveryMetrics reads the delivery and quota gauges while the servers
|
||||
// run. It is nil when the database is not configured.
|
||||
deliveryMetrics *deliverymetrics.Sampler
|
||||
@@ -66,19 +70,21 @@ func NewApplication(
|
||||
consumers eventConsumers,
|
||||
jobs *jobrunner.Worker,
|
||||
mailSending *mailsender.Worker,
|
||||
notificationSending *notificationSendingWorker,
|
||||
deliveryMetrics *deliverymetrics.Sampler,
|
||||
) *Application {
|
||||
return &Application{
|
||||
config: config,
|
||||
apiHandler: apiHandler,
|
||||
metrics: metrics,
|
||||
logger: logger,
|
||||
mailSender: mailSender,
|
||||
relay: relay,
|
||||
consumers: consumers,
|
||||
jobs: jobs,
|
||||
mailSending: mailSending,
|
||||
deliveryMetrics: deliveryMetrics,
|
||||
config: config,
|
||||
apiHandler: apiHandler,
|
||||
metrics: metrics,
|
||||
logger: logger,
|
||||
mailSender: mailSender,
|
||||
relay: relay,
|
||||
consumers: consumers,
|
||||
jobs: jobs,
|
||||
mailSending: mailSending,
|
||||
notificationSending: notificationSending,
|
||||
deliveryMetrics: deliveryMetrics,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +230,9 @@ func (application *Application) startWorkers(ctx context.Context) <-chan struct{
|
||||
if application.mailSending != nil {
|
||||
workers.Go(func() { application.mailSending.Run(ctx) })
|
||||
}
|
||||
if application.notificationSending != nil {
|
||||
workers.Go(func() { application.notificationSending.Run(ctx) })
|
||||
}
|
||||
if application.deliveryMetrics != nil {
|
||||
workers.Go(func() { application.deliveryMetrics.Run(ctx) })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user