From f4ecceb0e15673d680ad41a73c5c463c327b757d Mon Sep 17 00:00:00 2001 From: caffix Date: Tue, 20 Jun 2023 17:51:29 -0400 Subject: [PATCH] attempts to reduce use of data sources for ASN information --- datasrcs/scripting/script.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datasrcs/scripting/script.go b/datasrcs/scripting/script.go index 1f9636eb6..be5bce47a 100644 --- a/datasrcs/scripting/script.go +++ b/datasrcs/scripting/script.go @@ -357,8 +357,11 @@ func (s *Script) dispatch(in interface{}) { if s.cbs.Asn.Type() != lua.LTNil && req != nil && (req.Address != "" || req.ASN != 0) { callback := s.cbs.Asn s.cbsLock.Unlock() - s.CheckRateLimit() - s.asnRequest(s.ctx, callback, req) + // check that the cache entry has not already been made by a previous request + if s.sys.Cache().AddrSearch(req.Address) == nil { + s.CheckRateLimit() + s.asnRequest(s.ctx, callback, req) + } } case *requests.WhoisRequest: if s.cbs.Horizontal.Type() != lua.LTNil {