Skip to content

Conversation

@crazytonyli
Copy link
Contributor

Considering WordPressAPI and WordPressApiCache do not have mutable states, and all their properties conform to Sendable, declaring them as a Sendable class should have no practical impact.

The main motivation is that I don't think we need/should use await when accessing their properties:

let api: WordPressAPI = ...
let delegate = /* ~await~ */ api.apiClientDelegate

let apiCache: WordPressApiCache = ...
let cache = /* ~await~ */ apiCache.cache

use(delegate)

BTW, the publicized properties help integrate #1024 into the app.

@crazytonyli crazytonyli requested a review from jkmassel December 4, 2025 09:26
private let apiUrlResolver: ApiUrlResolver
let requestExecutor: SafeRequestExecutor
private let apiClientDelegate: WpApiClientDelegate
public let apiClientDelegate: WpApiClientDelegate
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for this change? I think I'd rather define whatever methods we need on WordPressAPI than allow others to reach into this objects implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to provide a convenient way to pass the delegate instance to WpSelfHostedService. I have reverted this change. There are other ways, though less convenient.

@crazytonyli crazytonyli requested a review from jkmassel December 8, 2025 09:05
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.

3 participants