Skip to content

[#528] actor에서 Task.detached를 사용하지 않고 백그라운드 스레드로 작업을 할 수 있도록 개선한다#531

Merged
opficdev merged 4 commits into
developfrom
refactor/#528-actor
Jun 4, 2026
Merged

[#528] actor에서 Task.detached를 사용하지 않고 백그라운드 스레드로 작업을 할 수 있도록 개선한다#531
opficdev merged 4 commits into
developfrom
refactor/#528-actor

Conversation

@opficdev

@opficdev opficdev commented Jun 4, 2026

Copy link
Copy Markdown
Owner

🔗 연관된 이슈

🎯 의도

  • 웹페이지 썸네일 이미지 저장 객체가 actor 내부에서 Task.detached로 파일 I/O를 수행하면서, 실제 저장 작업이 actor isolation 밖에서 실행되는 문제를 개선하기 위함
  • 파일 시스템 작업을 전용 직렬 큐에서 처리해 저장, 삭제, 디렉터리 정리 작업이 트랜잭션 단위로 수행되도록 보장하기 위함

📝 작업 내용

📌 요약

  • WebPageImageStoreImplactor에서 final class로 변경
  • 웹페이지 이미지 파일 I/O를 .utility QoS의 전용 DispatchQueue에서 실행하도록 변경
  • Task.detached 제거
  • 웹페이지 이미지 저장, 삭제, 디렉터리 정리 동작 테스트 추가
  • 동일 store 인스턴스를 공유하는 객체 간 저장 요청이 트랜잭션 단위로 반영되는지 검증하는 테스트 추가

🔍 상세

  • Task.detached(priority: .utility)로 분리되어 있던 파일 I/O 작업을 perform {} 내부로 모음
  • perform {}은 전용 serial queue에 작업을 enqueue하고 withCheckedThrowingContinuation으로 async API와 연결
  • cachedImageURL, saveImage, dirSizeInBytes, clearDirectory, removeImage가 모두 같은 serial queue를 통해 실행되도록 구성
  • 같은 URL에 대해 큰 데이터 저장 후 작은 데이터 저장을 요청했을 때, 최종 파일이 작은 데이터로 반영되는지 테스트
  • 테스트에서 각 저장 요청/완료 시점을 출력해 작업 완료 순서를 확인할 수 있도록 구성

📸 영상 / 이미지 (Optional)

image

@opficdev opficdev self-assigned this Jun 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors WebPageImageStoreImpl from an actor to a final class that serializes operations using a private DispatchQueue and withCheckedThrowingContinuation. It also introduces comprehensive unit tests in WebPageImageStoreImplTests.swift to verify saving, deleting, clearing the directory, and concurrent/transactional behavior. The review feedback suggests explicitly conforming WebPageImageStoreImpl to Sendable to ensure compatibility with Swift 6 strict concurrency, which is a highly relevant and actionable improvement.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@opficdev opficdev merged commit 1ca458a into develop Jun 4, 2026
5 checks passed
@opficdev opficdev deleted the refactor/#528-actor branch June 4, 2026 00:56
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.

actor에서 Task.detached를 사용하지 않고 백그라운드 스레드로 작업을 할 수 있도록 개선한다

1 participant