Skip to content

Commit

Permalink
fix resync-state kafka listener bug (port-labs#931)
Browse files Browse the repository at this point in the history
- **fix: kafka listener constant resync loop**
- **feat: bump version**

# Description
*Bugfix*

```diff
! What - Fix kafka listener never ending loop of resyncs bug
- Why - This bug was created when we started to updated the resyncState along with integration data,
- therefor each update would create a new audit-log change which triggered the Kafka listener to start a new resync
+ How - we validate that it was not an update created by the resyc-state by comparing them
```

## Type of change

Please leave one option from the following and delete the rest:

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] New Integration (non-breaking change which adds a new integration)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Non-breaking change (fix of existing functionality that will not
change current behavior)
- [ ] Documentation (added/updated documentation)

## Screenshots

Include screenshots from your environment showing how the resources of
the integration will look.

## API Documentation

Provide links to the API documentation used for this integration.

---------

Co-authored-by: Shalev Avhar <[email protected]>
  • Loading branch information
shalev007 and Shalev Avhar authored Aug 21, 2024
1 parent d54b97b commit 750dbe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Improvements

- Add support for reporting the integration resync state to expose more information about the integration state in the portal
- Fix kafka listener never ending resync loop due to resyncState updates


## 0.9.14 (2024-08-19)
Expand Down
10 changes: 7 additions & 3 deletions port_ocean/core/event_listener/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ def _should_be_processed(self, msg_value: dict[Any, Any], topic: str) -> bool:
return False

integration_identifier = after.get("identifier")
if integration_identifier == self.integration_identifier and (
"change.log" in topic
):
if integration_identifier != self.integration_identifier:
return False

if after.get("updatedAt") == after.get("resyncState", {}).get("updatedAt"):
return False

if "change.log" in topic:
return msg_value.get("changelogDestination", {}).get("type", "") == "KAFKA"

return False
Expand Down

0 comments on commit 750dbe9

Please sign in to comment.