Skip to content

Avoid Sendable data-race diagnostic in API completion#22

Merged
silvanocerza merged 1 commit intoipinfo:mainfrom
huseyiniyibas:main
Mar 26, 2026
Merged

Avoid Sendable data-race diagnostic in API completion#22
silvanocerza merged 1 commit intoipinfo:mainfrom
huseyiniyibas:main

Conversation

@huseyiniyibas
Copy link
Copy Markdown
Contributor

Summary

  • run Alamofire response handler on .main queue directly
  • remove nested DispatchQueue.main.async around completion
  • keep API behavior unchanged while avoiding Swift 6 sendability/data-race diagnostics

Context

Xcode/Swift 6 strict concurrency can report:
Sending 'completion' risks causing data races in Service.requestAPI.

This patch keeps callback delivery on the main thread via Alamofire's response queue and avoids capturing completion in an extra sendable closure.

Avoid DispatchQueue.main.async wrapping in requestAPI to prevent Swift 6 Sendable/data-race diagnostics when capturing completion.
Copy link
Copy Markdown
Contributor

@silvanocerza silvanocerza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🙏

Tests are failing because PRs from forks don't have access to secrets.
Locally everything is green.

@silvanocerza silvanocerza merged commit 252edf7 into ipinfo:main Mar 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants