Skip to content

Commit 10332b3

Browse files
committed
[fix] Return from task if WhoIs exists
There was an issue that the task was triggered for a device whose last_ip is updated but without checking if we already have WhoIs for the latest ip. Have added a check to return from the task if that is the case. Signed-off-by: DragnEmperor <[email protected]>
1 parent 59f97bd commit 10332b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

openwisp_controller/config/who_is/service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ def fetch_who_is_details(self, device_pk, initial_ip_address, new_ip_address):
209209
Fetches the WhoIs details of the given IP address
210210
and creates/updates the WhoIs record.
211211
"""
212+
# The task will be triggered if last_ip is updated without
213+
# checking if WhoIs is present for the new IP address, so
214+
# we return here if WhoIs is present for new IP address.
215+
if self._get_who_is_info_from_db(new_ip_address):
216+
return
217+
212218
WhoIsInfo = load_model("config", "WhoIsInfo")
213219

214220
try:

0 commit comments

Comments
 (0)