Skip to content

Commit

Permalink
Merge pull request #29 from fukusuket/fix-kvrocks-error-when-initial-…
Browse files Browse the repository at this point in the history
…intall

fix: Added exception handling when specify a key that does not exist in `SISMEMBER`
  • Loading branch information
adulau authored Aug 9, 2023
2 parents a47e32e + 8ad865e commit a0693d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/caida_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ipaddress import ip_network
from typing import Dict, Any

from redis import Redis
from redis import Redis, exceptions

from ipasnhistory.default import get_socket_path, AbstractManager, get_config
from ipasnhistory.helpers import get_data_dir
Expand All @@ -33,7 +33,10 @@ def _to_run_forever(self):
self.load_all()

def already_loaded(self, address_family: str, date: str) -> bool:
return self.storagedb.sismember(f'{self.key_prefix}|{address_family}|dates', date)
try:
return self.storagedb.sismember(f'{self.key_prefix}|{address_family}|dates', date)
except exceptions.ResponseError:
return False

def update_last(self, address_family: str, date: str) -> None:
cur_last = self.storagedb.get(f'{self.key_prefix}|{address_family}|last')
Expand Down

0 comments on commit a0693d8

Please sign in to comment.