fix backend

This commit is contained in:
2026-08-07 22:18:55 +03:00
parent 7aa84674f5
commit 1173a0f5c8
5 changed files with 9 additions and 16 deletions
@@ -6,7 +6,6 @@ import org.koin.core.annotation.Single
import ru.shadowsparky.backend.data.EnvFetcher
import ru.shadowsparky.backend.domain.JwtInfo
import ru.shadowsparky.vbox.backend.di.DbModule
import ru.shadowsparky.vbox.backend.di.EventModule
import ru.shadowsparky.vbox.backend.di.HttpModule
@Module
@@ -27,7 +26,6 @@ class VboxModule {
includes = [
DbModule::class,
HttpModule::class,
EventModule::class,
VboxModule::class
]
)
@@ -22,11 +22,16 @@ class SessionVideoApi(private val wrapper: VideoApi) : VideoApi {
private val linksMutex = Mutex()
override suspend fun fetchNewVideos(query: String?): VideosResponse {
val cacheKey = query ?: ""
val cacheKey = query.orEmpty()
videosCache.getValid(cacheKey)?.let { return it }
return videosMutex.withLock {
videosCache.getValid(cacheKey) ?: run {
val remoteData = wrapper.fetchNewVideos(query)
var remoteData = wrapper.fetchNewVideos(query)
remoteData = if (remoteData == videosCache[""]?.data) {
VideosResponse(false, emptyList(), 1)
} else {
remoteData
}
videosCache[cacheKey] = CacheEntry(remoteData)
remoteData
}
@@ -1,9 +0,0 @@
package ru.shadowsparky.vbox.backend.di
import org.koin.core.annotation.Module
@Module
class EventModule {
}