From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alex Bochannek Newsgroups: gmane.emacs.bugs Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning Date: Sat, 19 Jun 2021 12:24:00 -0700 Message-ID: References: <87r1h3tdys.fsf@gnus.org> <877diq108n.fsf@turtle-trading.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8688"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: Lars Ingebrigtsen , 49033@debbugs.gnu.org To: Benjamin Riefenstahl Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 19 21:25:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lugad-00022F-OX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 21:25:11 +0200 Original-Received: from localhost ([::1]:47598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lugac-00067L-5f for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 15:25:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lugaU-00065B-Qk for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 15:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lugaU-00049y-JF for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 15:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lugaU-0005sG-9e for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 15:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Jun 2021 19:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49033 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49033-submit@debbugs.gnu.org id=B49033.162413064522514 (code B ref 49033); Sat, 19 Jun 2021 19:25:02 +0000 Original-Received: (at 49033) by debbugs.gnu.org; 19 Jun 2021 19:24:05 +0000 Original-Received: from localhost ([127.0.0.1]:60843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lugZY-0005r4-TT for submit@debbugs.gnu.org; Sat, 19 Jun 2021 15:24:05 -0400 Original-Received: from ns.lapseofthought.com ([50.0.39.240]:58000 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lugZX-0005qv-4L for 49033@debbugs.gnu.org; Sat, 19 Jun 2021 15:24:03 -0400 Original-Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:4428:b3c:b897:c3aa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G6m1X6Fbnz3pdpY; Sat, 19 Jun 2021 12:24:00 -0700 (PDT) In-Reply-To: <877diq108n.fsf@turtle-trading.net> (Benjamin Riefenstahl's message of "Sat, 19 Jun 2021 14:56:40 +0200") Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208768 Archived-At: --=-=-= Content-Type: text/plain Benjamin Riefenstahl writes: > Hi Alex, > >>>> - ;; Twelve hours. >>>> - (* 12 60 60)))) >>>> + gravatar-cache-ttl))) > >> Lars Ingebrigtsen writes: >>> I don't mind that -- but is this really something that somebody would >>> want to control? It just seemed unlikely to me. > > Alex Bochannek writes: >> I tend to find it difficult to reason about functionality if constants >> like this are in the code and not in variables. > > Maybe use defconst instead? > > Just a drive-by thought, > benny I like that idea, that seems like a good compromise. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index f6f056a2ba..ebae356e26 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -51,6 +51,9 @@ gravatar-cache-ttl :group 'gravatar) (make-obsolete-variable 'gravatar-cache-ttl nil "28.1") +(defconst gravatar-cache-expiry (* 12 60 60) + "Time to live for gravatar cache entries (12 hours.)") + (defcustom gravatar-rating "g" "Most explicit Gravatar rating level to allow. Some gravatars are rated according to how suitable they are for @@ -287,8 +290,7 @@ gravatar-retrieve (defun gravatar--prune-cache () (let ((expired nil) (time (- (time-convert (current-time) 'integer) - ;; Twelve hours. - (* 12 60 60)))) + gravatar-cache-expiry))) (maphash (lambda (key val) (when (< (car val) time) (push key expired))) --=-=-= Content-Type: text/plain -- Alex. --=-=-=--