Fix next-campaigns to update fields irrespective of to_send
This commit is contained in:
parent
9582e20cd7
commit
2064f06218
2 changed files with 6 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue