Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix next-campaigns to update fields irrespective of to_send

Kailash Nadh2064f0621872
diff --git a/messenger/emailer.go b/messenger/emailer.go
index 98bcbca9..37341961 100644
--- a/messenger/emailer.go
+++ b/messenger/emailer.go
@@ -69,6 +69,8 @@ func (e *emailer) Name() string {
func (e *emailer) Push(fromAddr, toAddr, subject string, m []byte) error {
var key string
+ return nil
+
// If there are more than one SMTP servers, send to a random
// one from the list.
if e.numServers > 1 {
diff --git a/queries.sql b/queries.sql
index 24b2615f..0c698d2f 100644
--- a/queries.sql
+++ b/queries.sql
@@ -195,9 +195,11 @@ counts AS (
u AS (
-- For each campaign above, update the to_send count.
UPDATE campaigns AS ca
- SET to_send = co.to_send, max_subscriber_id = co.max_subscriber_id
+ SET to_send = co.to_send,
+ max_subscriber_id = co.max_subscriber_id,
+ started_at=(CASE WHEN ca.started_at IS NULL THEN NOW() ELSE ca.started_at END)
FROM (SELECT * FROM counts) co
- WHERE ca.id = co.campaign_id AND ca.to_send != co.to_send
+ WHERE ca.id = co.campaign_id
)
SELECT * FROM camps;