fix(slurpitsync): process interfaces synchronously instead of concurr…#115
fix(slurpitsync): process interfaces synchronously instead of concurr…#115
Conversation
WalkthroughThe change in 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying infrahub-sync with
|
| Latest commit: |
9dc6025
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://511f1e62.infrahub-sync.pages.dev |
| Branch Preview URL: | https://atg-20260217-slurpit-fix.infrahub-sync.pages.dev |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
infrahub_sync/adapters/slurpitsync.py (1)
118-118:filter_interfacescan be de-asyncified now that allawaitcalls are gone.After this change
filter_interfaceshas noawaitexpressions, yet it remainsasync def, and its only call-site (line 189) still wraps it inrun_async. The coroutine works but imposes a needless event-loop round-trip and hides the fact that the method is now purely synchronous.♻️ Proposed refactor
- async def filter_interfaces(self, interfaces) -> list: + def filter_interfaces(self, interfaces) -> list:- nodes = self.run_async(self.filter_interfaces(interfaces)) + nodes = self.filter_interfaces(interfaces)Also applies to: 151-152
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@infrahub_sync/adapters/slurpitsync.py` at line 118, The method filter_interfaces should be converted from "async def filter_interfaces" to a regular "def filter_interfaces(...)->list" since there are no awaits inside; change its signature and body to synchronous code (keep the same logic and return type). Update its call-site(s) that currently wrap it with run_async (and any await/run_async usage) to call filter_interfaces directly and use the returned list synchronously. Also check the similar case referenced around the nearby functions (the other async defs at the same region) and apply the same de-asyncify + caller update for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@infrahub_sync/adapters/slurpitsync.py`:
- Line 118: The method filter_interfaces should be converted from "async def
filter_interfaces" to a regular "def filter_interfaces(...)->list" since there
are no awaits inside; change its signature and body to synchronous code (keep
the same logic and return type). Update its call-site(s) that currently wrap it
with run_async (and any await/run_async usage) to call filter_interfaces
directly and use the returned list synchronously. Also check the similar case
referenced around the nearby functions (the other async defs at the same region)
and apply the same de-asyncify + caller update for consistency.
…ently
Summary by CodeRabbit