Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] ICS 배포 큐 구현 #966

Merged
merged 7 commits into from
May 10, 2024
Merged

[BE] ICS 배포 큐 구현 #966

merged 7 commits into from
May 10, 2024

Conversation

pilyang
Copy link
Collaborator

@pilyang pilyang commented May 8, 2024

이슈번호

close #955

PR 내용

ics 배포시 대기큐 사용

기존
IcalendarEventListener 에서 바로 배포 수행
한팀에서 여러번 중복 배포시 (일정에 짧은시간에 지속적으로 변동 시) 단위시간 동안 변동 횟수가 많으면 배포를 멈추고 남은 단위시간마다 미뤄진 팀에 대한 배포를 1회씩 몰아서 진행

변경
DeployWaitingQueue 배포 대기큐 구현
EventListner에서 배포큐에 배포할 팀플레이스 아이디 추가
IcsPublisher에서 배포대기큐에 값이 있으면 꺼내서 배포 수행
IcsPublisher는 스케쥴러를 통해 실행

배포대기큐에 값을 unique하게 관리해서 동시요청시 1회만 처리할 수 있도록 구현

구현 내용

UniqueBlockingQueue

  • 한 팀플레이스에서 동시에 일정변동시 값들을 unique하게 유지하기 위해 구현
  • Set과, BlocckingQueue를 사용

DeployWaitingQueue

위의 유니크큐를 2개를 가지게 함

  • createQueue : ics를 배포하지 않던 팀에서 배포요청시 해당 큐에 삽입
  • updateQueue : 기존 배포중이던 팀에서 업데이트 요청시 해당 큐에 삽입

createQueue의 우선순위를 높게 설정
이유

  • 사용자 경험상 어차피 배포중인 ics파일은 사용자가 사용하는 캘린더 서비스에 따라 바로 우리 서비스에서 배포중인 ics를 가져오는게 아니라서 바로바로 반영을 해줘도 소용이 없음 -> 조금 늦어져도 됨
  • 하지만 아직 배포중이지 않던 팀에서 ics배포가 늦어지면 사용자는 배포 url확인란에서 배포 대기중이라는 메시지만 장기간 노출이 되어 서비스가 바로바로 적용이 된다는 경험을 못하게 될 수 있음

IcsPublisher

  • DeployWaitingQueue의 consumer 역할
  • 기존의 IcsPublishService를 이용해서 배포 수행
  • 큐에 값이 없으면 대기 (10초) - 지금은 사용자가 적어 대기시간을 길게 가져갔고, 이후 필요에따라 시간을 줄이는게 좋을 것 같음

IcsPublisherScheduling, IcsPublisherSchedulingConfig

  • IcsPublisher 를 스케쥴링하여 실행
  • 스레드풀 초과하여 스케쥴러 수행시 DiscardPolicy 정책 선택
    • 어차피 큐 poll대기를 걸어두는거지 특정한 값으로 태스크를 수항하는것이 아니여서 해당 정책 선택함

임시 간략 이미지
image

- poll(timeout, unit) method 추가
- isEmpty, contains method 추가
- createQueue, updateQueue 분리
- createQueue에 우선순위를 부여하여 새로운 캘린더 배포의 작업 빈도 상향
- 기존 : IcalendarEventListener 에서 직접 배포 호출
- 변경 : 배포 대기큐 적용
  - IcalendarEventListener: 배포대기큐에 팀플레이스 아이디 추가
  - DeplowWaitingQueue: UniqueQeueu로 배포 대기큐 구현
  - IcsPublisher: DeplowWaitingQueue에 있으면 배포 진행
  - IcsPublisherThreadScheduling: IcsPublisher 스케쥴링으로 실행
Copy link

github-actions bot commented May 8, 2024

Test Results

159 files  159 suites   31s ⏱️
510 tests 510 ✅ 0 💤 0 ❌
514 runs  514 ✅ 0 💤 0 ❌

Results for commit fe7d311.

♻️ This comment has been updated with latest results.

- icalendar Test configuration package 제거
- Service테스트시 동기 Executor -> inner class configuration
- test환경에서 bean override 허용
@pilyang pilyang merged commit 5f50c48 into develop May 10, 2024
3 checks passed
@pilyang pilyang deleted the feat/be/ical-deploy-queue branch May 10, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] 캘린더 배포 기능 리팩터링 - 배포 대기큐 구현
1 participant