Skip to content

Commit fd744f2

Browse files
committed
chore: delete cached
1 parent f3f66b9 commit fd744f2

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
name='smartdns',
2727
description='An Intelligent DNS Similar to DNSPod',
28-
version='3.2.2',
28+
version='3.2.3',
2929
author='duanhongyi',
3030
author_email='duanhyi@gmail.com',
3131
packages=find_packages(),

smartdns/ippool.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def long2ip(num):
2828
return '.'.join(iplist)
2929

3030

31-
class IPPool(object):
31+
class BaseIPPool(object):
3232
def __init__(self, ipfile, recordfile):
3333
if not isfile(ipfile):
3434
logger.warning("can't find ip data file: %s" % ipfile)
@@ -209,20 +209,14 @@ def FindIP(self, ip, name):
209209
return ip_list
210210

211211

212-
class CachedIPPool(object):
212+
class IPPool(object):
213213

214214
def __init__(self, ipfile, recordfile, monitor_mapping):
215-
self.caches = {}
216215
self.monitor_mapping = monitor_mapping
217-
self.finder = IPPool(ipfile, recordfile)
216+
self.finder = BaseIPPool(ipfile, recordfile)
218217

219218
def FindIP(self, ip, name):
220-
key = "%s-%s" % (ip, name)
221-
if key in self.caches:
222-
tmp_ip_list = self.caches[key]
223-
else:
224-
tmp_ip_list = self.finder.FindIP(ip, name)
225-
self.caches[key] = tmp_ip_list
219+
tmp_ip_list = self.finder.FindIP(ip, name)
226220
ip_list = [
227221
tmp_ip for tmp_ip in tmp_ip_list if self.monitor_mapping.check(name, tmp_ip)]
228222
if len(ip_list) == 0:

smartdns/sdns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def prepare_run(run_env):
4444
monitor_mapping = monitor.MonitorMapping(monitor_config, a_mapping)
4545
# load dns record config file
4646
logger.info('start to init IP pool ......')
47-
finder = ippool.CachedIPPool(
47+
finder = ippool.IPPool(
4848
os.path.join(run_env['conf'], 'ip.csv'),
4949
os.path.join(run_env['conf'], 'a.yaml'),
5050
monitor_mapping)

0 commit comments

Comments
 (0)