test #332
|
@ -61,7 +61,7 @@ interface LiveRoomQueryRepository {
|
|||
fun getTotalHeartCount(roomId: Long): Int?
|
||||
fun getLiveRoomCreatorId(roomId: Long): Long?
|
||||
fun getHeartList(roomId: Long): List<GetLiveRoomHeartListItem>
|
||||
fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse>
|
||||
fun getLatestFinishedLive(): List<GetLatestFinishedLiveQueryResponse>
|
||||
}
|
||||
|
||||
class LiveRoomQueryRepositoryImpl(
|
||||
|
@ -383,7 +383,7 @@ class LiveRoomQueryRepositoryImpl(
|
|||
.fetch()
|
||||
}
|
||||
|
||||
override fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse> {
|
||||
override fun getLatestFinishedLive(): List<GetLatestFinishedLiveQueryResponse> {
|
||||
val liveRoom = liveRoom
|
||||
val subLiveRoom = QLiveRoom.liveRoom
|
||||
|
||||
|
@ -413,7 +413,6 @@ class LiveRoomQueryRepositoryImpl(
|
|||
.`in`(subQuery)
|
||||
)
|
||||
.orderBy(liveRoom.updatedAt.desc())
|
||||
.offset(offset)
|
||||
.limit(20)
|
||||
.fetch()
|
||||
}
|
||||
|
|
|
@ -1298,25 +1298,16 @@ class LiveRoomService(
|
|||
}
|
||||
|
||||
fun getLatestFinishedLive(member: Member?): List<GetLatestFinishedLiveResponse> {
|
||||
val result = mutableListOf<GetLatestFinishedLiveResponse>()
|
||||
var retry = 0L
|
||||
|
||||
do {
|
||||
result.addAll(
|
||||
repository.getLatestFinishedLive(offset = retry)
|
||||
.filter {
|
||||
if (member?.id != null) {
|
||||
!blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.memberId)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
.map {
|
||||
GetLatestFinishedLiveResponse(response = it)
|
||||
}
|
||||
)
|
||||
} while (result.size < 20 && retry++ < 3)
|
||||
|
||||
return result.take(20)
|
||||
return repository.getLatestFinishedLive()
|
||||
.filter {
|
||||
if (member?.id != null) {
|
||||
!blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.memberId)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
.map {
|
||||
GetLatestFinishedLiveResponse(response = it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue