Skip to content

Commit

Permalink
Fix poll_db crash when notifications payload indeces is None (#537)
Browse files Browse the repository at this point in the history
* Checks payload indices key non-null value before attempting to iterate during syncs

* adding timeout parameter to search client in aws hosted opensearch and elasticsearch

* Revert "adding timeout parameter to search client in aws hosted opensearch and elasticsearch"

This reverts commit cb14829.
  • Loading branch information
mpaolino committed Jun 11, 2024
1 parent 3f5d5ba commit de81269
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pgsync/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ def poll_db(self) -> None:
notification: t.AnyStr = conn.notifies.pop(0)
if notification.channel == self.database:
payload = json.loads(notification.payload)
if self.index in payload["indices"]:
if payload["indices"] and self.index in payload["indices"]:
payloads.append(payload)
logger.debug(f"poll_db: {payload}")
self.count["db"] += 1
Expand All @@ -1145,7 +1145,7 @@ def async_poll_db(self) -> None:
notification: t.AnyStr = self.conn.notifies.pop(0)
if notification.channel == self.database:
payload = json.loads(notification.payload)
if self.index in payload["indices"]:
if payload["indices"] and self.index in payload["indices"]:
self.redis.push([payload])
logger.debug(f"async_poll: {payload}")
self.count["db"] += 1
Expand Down

0 comments on commit de81269

Please sign in to comment.