Skip to content

Add API-level campaign delivery window pacing#3144

Draft
esokullu wants to merge 2 commits into
knadh:masterfrom
esokullu:agent/campaign-delivery-window
Draft

Add API-level campaign delivery window pacing#3144
esokullu wants to merge 2 commits into
knadh:masterfrom
esokullu:agent/campaign-delivery-window

Conversation

@esokullu

@esokullu esokullu commented Jul 13, 2026

Copy link
Copy Markdown

Summary

This adds campaign-level delivery window pacing so a single campaign can be spread evenly over a configured time window without manually splitting a list into many smaller campaigns.

New API fields:

  • send_until: absolute timestamp that marks the end of the delivery window.
  • send_window: convenience duration such as 24h; it is converted to send_until relative to send_at, or to the current time when send_at is empty.

Example:

{
  "send_at": "2026-07-14T10:00:00Z",
  "send_window": "24h"
}

The campaign remains one campaign in the UI/API. It does not create child campaigns or separate drip records.

Why

listmonk already has global throughput and sliding-window rate limits, which are useful for server/provider limits. This patch targets a different use case: per-campaign pacing for sender reputation, warmup, and scheduled newsletter delivery.

Without this, users who want to send one campaign over 12-24 hours have to manually create list segments and schedule many separate campaigns. That fragments analytics and is easy to misconfigure.

Implementation Notes

  • Adds nullable campaigns.send_until with a migration.
  • Exposes send_until on campaign models and API responses.
  • Adds send_window as an API-only helper field for create/update requests.
  • Updates campaign validation so send_until must be after send_at or now.
  • Paces fetching subscribers in the campaign pipe. This avoids advancing last_subscriber_id ahead of unsent work and keeps progress on one campaign row.
  • Existing behavior is unchanged when send_until / send_window are not set.

Testing

  • Added focused unit tests for paced batch allowance calculation.
  • git diff --check passes locally.
  • I could not run the full Go test suite in my local environment because Go was not installed there; CI should verify the full build/test matrix.

Follow-up

This is intentionally backend/API-first. If the approach is acceptable, a follow-up can add UI controls such as "Send immediately" vs "Spread over..." to the campaign form.

@esokullu esokullu changed the title Add campaign delivery window pacing Add API-level campaign delivery window pacing Jul 13, 2026
@esokullu esokullu marked this pull request as draft July 13, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant