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.data.EnvFetcher
import ru.shadowsparky.backend.domain.JwtInfo import ru.shadowsparky.backend.domain.JwtInfo
import ru.shadowsparky.vbox.backend.di.DbModule import ru.shadowsparky.vbox.backend.di.DbModule
import ru.shadowsparky.vbox.backend.di.EventModule
import ru.shadowsparky.vbox.backend.di.HttpModule import ru.shadowsparky.vbox.backend.di.HttpModule
@Module @Module
@@ -27,7 +26,6 @@ class VboxModule {
includes = [ includes = [
DbModule::class, DbModule::class,
HttpModule::class, HttpModule::class,
EventModule::class,
VboxModule::class VboxModule::class
] ]
) )
@@ -22,11 +22,16 @@ class SessionVideoApi(private val wrapper: VideoApi) : VideoApi {
private val linksMutex = Mutex() private val linksMutex = Mutex()
override suspend fun fetchNewVideos(query: String?): VideosResponse { override suspend fun fetchNewVideos(query: String?): VideosResponse {
val cacheKey = query ?: "" val cacheKey = query.orEmpty()
videosCache.getValid(cacheKey)?.let { return it } videosCache.getValid(cacheKey)?.let { return it }
return videosMutex.withLock { return videosMutex.withLock {
videosCache.getValid(cacheKey) ?: run { 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) videosCache[cacheKey] = CacheEntry(remoteData)
remoteData remoteData
} }
@@ -1,9 +0,0 @@
package ru.shadowsparky.vbox.backend.di
import org.koin.core.annotation.Module
@Module
class EventModule {
}
@@ -68,6 +68,5 @@
<string name="movie_tags_empty">Настроить теги</string> <string name="movie_tags_empty">Настроить теги</string>
<string name="user_tags_filter_disable">Не фильтровать</string> <string name="user_tags_filter_disable">Не фильтровать</string>
<string name="check_for_updates">Поиск обновлений</string> <string name="check_for_updates">Поиск обновлений</string>
<string name="chat_title_app_bar">Братан СвинGPT</string> <string name="chat_title_app_bar">СвинGPT</string>
<string name="chat_title">СвинGPT</string>
</resources> </resources>
@@ -76,7 +76,7 @@ class HttpClientSettings(
} }
} }
install(Logging) { install(Logging) {
val isDebug = koin.getOrNull<AppConfig>()?.debug ?: true val isDebug = koin.getOrNull<AppConfig>()?.debug ?: false
if (isDebug) { if (isDebug) {
this.level = LogLevel.ALL this.level = LogLevel.ALL
this.logger = object : Logger { this.logger = object : Logger {