Fix capabilities throttling approach#65
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the capabilities throttling approach by replacing the use of capabilitiesString with a new property named capabilities, and integrates caching using a dedicated actor. Key changes include updating test files to use the new property, refactoring the MockRemoteInterface accordingly, and modifying the NextcloudKit+RemoteInterface logic to cache capabilities.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/UploadTests.swift | Replaces "capabilitiesString" with "capabilities" in upload tests. |
| Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift | Updates capability assignments to reflect the new property naming. |
| Tests/NextcloudFileProviderKitTests/ItemDeleteTests.swift & ItemCreateTests.swift | Adjusts string checks and reassignments for capabilities in delete and create tests. |
| Tests/Interface/MockRemoteInterface.swift | Removes the capabilitiesString property in favor of capabilities and updates associated logic. |
| Sources/NextcloudFileProviderKit/Interface/RemoteInterface.swift & NextcloudKit+RemoteInterface.swift | Refactors capability fetching to leverage a caching actor and removes the direct setting of capabilities. |
Comments suppressed due to low confidence (2)
Tests/Interface/MockRemoteInterface.swift:562
- [nitpick] The property 'capabilities' has been renamed from 'capabilitiesString'. Please ensure that its type (a string) is clearly documented to avoid any confusion with a potential Capabilities object used elsewhere.
public var capabilities = mockCapabilities
Sources/NextcloudFileProviderKit/Interface/NextcloudKit+RemoteInterface.swift:422
- [nitpick] Consider refactoring the caching condition to improve clarity. Using a positive measure of elapsed time (e.g., Date().timeIntervalSince(lastRetrieval.retrievedAt)) may make the logic more intuitive.
guard let lastRetrieval = await RetrievedCapabilitiesActor.shared.data[ncKitAccount], lastRetrieval.retrievedAt.timeIntervalSince(Date()) > -CapabilitiesFetchInterval else {
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
- Coverage 81.78% 81.64% -0.14%
==========================================
Files 61 61
Lines 12689 12696 +7
==========================================
- Hits 10378 10366 -12
- Misses 2311 2330 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.