Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Integration][Gitlab] Made event processing sequential to temporarily…
… resolve race condition issues (#1217) # Description **What** - Updated the event handling logic in both `EventHandler` and `SystemEventHandler` to ensure sequential processing of observers and hook handlers. - Removed concurrent execution (`asyncio.gather` and `asyncio.create_task`) and replaced it with sequential execution. **Why** - The previous implementation processed events concurrently across multiple observers and hook handlers, which led to race conditions when shared entities were updated. - This caused data inconsistency, as concurrent updates overwrote each other's changes. - Sequential processing ensures that each observer and handler processes the event one at a time, maintaining data integrity. **How** 1. `EventHandler` Changes: - Replaced `asyncio.create_task` for observer notifications with a direct `await` call. - Ensured observers for a specific event are processed in a sequential manner. 2. `SystemEventHandler` Changes: - Removed `asyncio.gather` for hook handlers and replaced it with nested `for` loops. - Handlers are now invoked sequentially for each client, ensuring predictable and ordered execution. ## Type of change Please leave one option from the following and delete the rest: - [x] Bug fix (non-breaking change which fixes an issue) <h4> All tests should be run against the port production environment(using a testing org). </h4> ### Core testing checklist - [ ] Integration able to create all default resources from scratch - [ ] Resync finishes successfully - [ ] Resync able to create entities - [ ] Resync able to update entities - [ ] Resync able to detect and delete entities - [ ] Scheduled resync able to abort existing resync and start a new one - [ ] Tested with at least 2 integrations from scratch - [ ] Tested with Kafka and Polling event listeners - [ ] Tested deletion of entities that don't pass the selector ### Integration testing checklist - [x] Integration able to create all default resources from scratch - [x] Resync able to create entities - [x] Resync able to update entities - [x] Resync able to detect and delete entities - [x] Resync finishes successfully - [ ] If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the `examples` folder in the integration directory. - [ ] If resource kind is updated, run the integration with the example data and check if the expected result is achieved - [ ] If new resource kind is added or updated, validate that live-events for that resource are working as expected - [ ] Docs PR link [here](#) ### Preflight checklist - [ ] Handled rate limiting - [ ] Handled pagination - [ ] Implemented the code in async - [ ] Support Multi account ## 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: Matan <[email protected]>
- Loading branch information