From patchwork Wed Mar 30 09:56:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5417 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4KT2055Jfzz3wf7 for ; Wed, 30 Mar 2022 09:56:53 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4KT1zz3BxRz443; Wed, 30 Mar 2022 09:56:47 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KT1zz2zwmz2yqq; Wed, 30 Mar 2022 09:56:47 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KT1zx0rjkz2ySg for ; Wed, 30 Mar 2022 09:56:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KT1zw71lHz443; Wed, 30 Mar 2022 09:56:44 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1648634205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O8q1ckHCjWC6Bk+aEVoQwAso+FuiY9BXGYn/PjGz2mw=; b=Y+3S//aGAXoadJ5CcZdR6Xom18A/B6BjWd7LFNnk9nf9yrmgnH/4j8PpS4b5aooi44Agc4 SnPcGychM/nWWYCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1648634205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O8q1ckHCjWC6Bk+aEVoQwAso+FuiY9BXGYn/PjGz2mw=; b=SxR0CW3d2rhQXejIqSBQhl5HpMvkr/YUY3Cg7QSYPQECDWzsWzSFLH3ZKlA0tgqBr1BYuF 5WO4sEM6U5OhBGW+bI8qSQj9cNaV9vJkLvKoou3BR4KnlaO7axieC42QJ/ylJ0HveDdZ5J hgmFu5ph2C5tPOkQvOLHJCjSbffD0eBGlWARlMVGqh+p9191s+yDBge3bloreDdJHL2uCY TOpckrqGbDBloo2ElxTzEbC6gouM4/YyChArL8lQtCT3C8lfdYidtgHLyLE4Pu7G/BqjM0 Y9omTbO1A24xk95eSwXxsaCZpgZFWIXjKEvQyk7yGWvv8WyMgzGFOiCLDPyyTQ== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH v2 3/5] unbound-dhcp-leases-bridge: Read configuration only once Date: Wed, 30 Mar 2022 09:56:33 +0000 Message-Id: <20220330095635.621181-3-michael.tremer@ipfire.org> In-Reply-To: <20220330095635.621181-1-michael.tremer@ipfire.org> References: <20220330095635.621181-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This saves some resources when we re-read the same configuration file too often. Suggested-by: Anthony Heading Signed-off-by: Michael Tremer --- config/unbound/unbound-dhcp-leases-bridge | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index c0e5977bf..b098d98b4 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -22,6 +22,7 @@ import argparse import datetime import daemon +import functools import ipaddress import logging import logging.handlers @@ -444,6 +445,7 @@ class Lease(object): return "localdomain" @staticmethod + @functools.cache def read_settings(filename): settings = {}