Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-05-28 - Avoid actor for parallel synchronous I/O
**Learning:** Using an `actor` to manage a `withTaskGroup` where tasks invoke synchronous, blocking I/O (like `FileManager` operations) directly on the actor inadvertently serializes the tasks, preventing parallelism.
**Action:** For stateless components interacting with thread-safe dependencies (like `FileManager`), use `struct`s or `nonisolated` methods to allow tasks to execute concurrently across threads.
2 changes: 1 addition & 1 deletion Sources/Cacheout/Cleaner/CacheCleaner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import Foundation
import AppKit

actor CacheCleaner {
struct CacheCleaner {
private let fileManager = FileManager.default

func clean(results: [ScanResult], nodeModules: [NodeModulesItem] = [], moveToTrash: Bool) async -> CleanupReport {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Cacheout/Scanner/CacheScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import Foundation

actor CacheScanner {
struct CacheScanner {
private let fileManager = FileManager.default

func scanAll(_ categories: [CacheCategory]) async -> [ScanResult] {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Cacheout/Scanner/NodeModulesScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import Foundation

actor NodeModulesScanner {
struct NodeModulesScanner {
private let fileManager = FileManager.default

/// Common directories where developers keep projects
Expand Down