Skip to content

Commit 201c4ee

Browse files
authored
65 feat/rate limiting and scheduling (#73)
* feat: add mail processor that gets triggered every 30 secs * feat: create background process for sending queued mails * fix: resolve the problem with the auto-refetching of the campaign after campaign creation with no campaigns prior * feat: add enqueue for the emails sent with smtp server and minor UI fixes on sidebar * feat: create migration file that adds rate_limit col * feat: add rate-limiting for sending the mail from the queue using both smtp server and aws client * feat: update email delivery, bounce, open, and click rates tracking for the mails sent from the AWS server as use of rate-limiting write test for the rate_limiting refactor the mail_service.rs file * fix: add the missing rate_limit field in server struct and its test files: * fix: add the missing input field for the rate_limit on the server Form and fix the default values for the deafault_value and rate_limit input fields * fix: refactor the rate limiting assertions
1 parent 295dedf commit 201c4ee

File tree

46 files changed

+1051
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1051
-293
lines changed

backend/Cargo.lock

Lines changed: 148 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ axum-extra = { version = "0.10.0", features = ["multipart"] }
4545
csv = "1.3.1"
4646

4747
lettre = "0.11.14"
48-
48+
tokenbucket = "0.1.6"
49+
governor = "0.10.0"
4950

5051

5152
[dev-dependencies]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Rollback: Remove queuing and rate-limiting fields from mails table
2+
3+
ALTER TABLE mails
4+
DROP COLUMN scheduled_at,
5+
DROP COLUMN attempts,
6+
DROP COLUMN last_error;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Migration: Add queuing and rate-limiting fields to mails table
2+
3+
ALTER TABLE mails
4+
ADD COLUMN "scheduled_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
5+
ADD COLUMN "attempts" INTEGER DEFAULT 0 NOT NULL,
6+
ADD COLUMN "last_error" TEXT;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Down Migration: remove the rate_limit column
2+
ALTER TABLE "servers"
3+
DROP COLUMN IF EXISTS "rate_limit";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Up Migration: add the rate_limit column with a default value
2+
ALTER TABLE "servers"
3+
ADD COLUMN "rate_limit" INTEGER NOT NULL DEFAULT 60;

0 commit comments

Comments
 (0)