~witcher/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
5 2

[PATCH 1/3] Drop some unnecessary lettre features

Details
Message ID
<20221212193217.443058-1-hugo@whynothugo.nl>
DKIM signature
missing
Download raw message
Patch: +1 -1
---
 Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 67e6d70..a565e00 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ reqwest = {version = "0.11", default-features = false, features = ["rustls-tls"]
clap = { version = "3", features = ["derive"] }
chrono = "0.4"
toml = "0.5.8"
lettre = { version = "0.10.1", default-features = false, features = ["rustls", "rustls-tls", "builder", "smtp-transport", "pool", "tokio1", "tokio1-rustls-tls"] }
lettre = { version = "0.10.1", default-features = false, features = ["builder", "smtp-transport", "pool", "tokio1", "tokio1-rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
directories = "4.0.1"
log = "0.4.17"
-- 
2.38.1

[PATCH 2/3] Leave a note on the impact of the "pool" feature

Details
Message ID
<20221212193217.443058-2-hugo@whynothugo.nl>
In-Reply-To
<20221212193217.443058-1-hugo@whynothugo.nl> (view parent)
DKIM signature
missing
Download raw message
Patch: +2 -0
I had previously implemented sending of emails with the async transport
(together with async fetching of RSS), though I now realise I'd never
sent the patch.

While implementing this, I realised that the "pool" feature has a huge
impact on the speed of sending emails: by merely having the feature
enabled the transport instance will keep the connection open between
messages (avoiding a connecting and authenticating a second time).

Just leaving a comment on that for future reference.
---
 Cargo.toml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Cargo.toml b/Cargo.toml
index a565e00..0f205ec 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,8 @@ reqwest = {version = "0.11", default-features = false, features = ["rustls-tls"]
clap = { version = "3", features = ["derive"] }
chrono = "0.4"
toml = "0.5.8"
# Adding the "pool" feature changes the behaviour so that a transport keeps a
# connection open between sent emails.
lettre = { version = "0.10.1", default-features = false, features = ["builder", "smtp-transport", "pool", "tokio1", "tokio1-rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
directories = "4.0.1"
-- 
2.38.1

[PATCH 3/3] Trace-log sending of individual messages

Details
Message ID
<20221212193217.443058-3-hugo@whynothugo.nl>
In-Reply-To
<20221212193217.443058-1-hugo@whynothugo.nl> (view parent)
DKIM signature
missing
Download raw message
Patch: +3 -2
---
This mostly helped me figure out that the `pool` feature did what I expected,
and is mostly useful for debugging this kind of thing.
 src/mail.rs | 3 ++-
 src/main.rs | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mail.rs b/src/mail.rs
index d895b9f..382609a 100644
--- a/src/mail.rs
+++ b/src/mail.rs
@@ -23,7 +23,7 @@ pub async fn send_email<S, I>(
    config: &Config,
    subject: S,
    body: I,
    mailer: AsyncSmtpTransport<Tokio1Executor>,
    mailer: &AsyncSmtpTransport<Tokio1Executor>,
) -> anyhow::Result<()>
where
    S: AsRef<str>,
@@ -35,6 +35,7 @@ where
        .subject(subject.as_ref())
        .body(body.into())?;

    trace!("Sending to {}: {}", config.to, subject.as_ref());
    mailer.send(email).await?;

    Ok(())
diff --git a/src/main.rs b/src/main.rs
index 9d30382..08122d0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -115,7 +115,7 @@ where
            Some(c) => c + "\n\n" + &post.url.unwrap(),
            None => post.url.unwrap(),
        };
        send_email(&config, subject, body, mailer).await?;
        send_email(&config, subject, body, &mailer).await?;
    }

    sqlx::query!("update posts set sent = true where guid = ?", post.guid)
-- 
2.38.1
Details
Message ID
<20221212210504.vv6sddtrnm77aiaz@navi>
In-Reply-To
<20221212193217.443058-1-hugo@whynothugo.nl> (view parent)
DKIM signature
missing
Download raw message
Applied, thank you!
Just a small reminder, I set up a list for patches for rss-email at
https://lists.sr.ht/~witcher/rss-email-devel.

-- 
witcher
Details
Message ID
<525bc483-409b-4e10-a294-0fd8c1526305@app.fastmail.com>
In-Reply-To
<20221212210504.vv6sddtrnm77aiaz@navi> (view parent)
DKIM signature
missing
Download raw message
On Mon, 12 Dec 2022, at 22:05, witcher wrote:
> Applied, thank you!
> Just a small reminder, I set up a list for patches for rss-email at
> https://lists.sr.ht/~witcher/rss-email-devel.
>
> -- 
> witcher
>
> Attachments:
> * signature.asc

My bad, I picked the wrong one from my shell history.

I just realised I can configure this just one per checked-out repo:

    git config sendemail.to "~witcher/rss-email-devel@lists.sr.ht"

-- 
Hugo
Details
Message ID
<20221212212656.ewe2m5s2tx5lex5m@navi>
In-Reply-To
<525bc483-409b-4e10-a294-0fd8c1526305@app.fastmail.com> (view parent)
DKIM signature
missing
Download raw message
On 12.12.22 10:17, Hugo Osvaldo Barrera wrote:
>My bad, I picked the wrong one from my shell history.
No harm done :)

>I just realised I can configure this just one per checked-out repo:
Exactly! Not sure how much you know about configuring it, and also to
mention it publicly here, too, Drew's git-send-email.io has a few handy
tips for more options as well! Specifying a sub-project for mailing
lists with multiple projects is something I think is especially helpful!
https://git-send-email.io/#step-5

Cheers!

-- 
witcher
Reply to thread Export thread (mbox)