From e30d1a40bc35d67aacf96fd2fdd8da8c7944e6ae Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sat, 18 Mar 2023 18:44:57 +0100 Subject: [PATCH] :sparkles: Avoid vthread pinning on invitations --- backend/src/app/rpc/commands/teams.clj | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index f7150bef86..6fa32a2a25 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -764,15 +764,17 @@ :hint "looks like the profile has reported repeatedly as spam or has permanent bounces")) (let [cfg (assoc cfg ::db/conn conn) - invitations (->> emails - (remove member?) - (map (fn [email] - {:email (str/lower email) - :team team - :profile profile - :role role})) - (keep (partial create-invitation cfg)))] - (with-meta (vec invitations) + invitations (into [] + (comp + (remove member?) + (map (fn [email] + {:email (str/lower email) + :team team + :profile profile + :role role})) + (keep (partial create-invitation cfg))) + emails)] + (with-meta invitations {::audit/props {:invitations (count invitations)}})))))