[3/3] unbound-dhcp-leases-bridge: Read configuration only once

Message ID 20220329113457.555479-3-michael.tremer@ipfire.org
State Superseded
Headers
Series [1/3] unbound-dhcp-leases-bridge: Improve logging |

Commit Message

Michael Tremer March 29, 2022, 11:34 a.m. UTC
  This saves some resources when we re-read the same configuration file
too often.

Suggested-by: Anthony Heading <ajrh@ajrh.net>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 config/unbound/unbound-dhcp-leases-bridge | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

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 = {}