From 6a3de1b57a40d1f6f295e4d220a997660bd8ec45 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Thu, 2 Feb 2023 16:02:27 +0100 Subject: [PATCH] chore(dolist): cache sender_id so we don't request it at each send --- app/lib/dolist/api.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/dolist/api.rb b/app/lib/dolist/api.rb index 0faa9f38e..e6ca3129e 100644 --- a/app/lib/dolist/api.rb +++ b/app/lib/dolist/api.rb @@ -123,7 +123,9 @@ class Dolist::API end def sender_id - @sender_id ||= senders.dig("ItemList", 0, "Sender", "ID") + Rails.cache.fetch("dolist_api_sender_id", expires_in: 1.hour) do + senders.dig("ItemList", 0, "Sender", "ID") + end end def get(url)