Tidies up the startup code to make it more readable
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
3e2f0ca681
commit
0aaa29b1e2
@ -21,19 +21,14 @@ class StartupService(
|
|||||||
@Async
|
@Async
|
||||||
@EventListener(ApplicationStartedEvent::class)
|
@EventListener(ApplicationStartedEvent::class)
|
||||||
suspend fun onStartup() {
|
suspend fun onStartup() {
|
||||||
if (withContext(ioDispatcher) {
|
val cacheType = if (withContext(ioDispatcher) { albumRepository.count() } == 0L) {
|
||||||
albumRepository.count()
|
CacheType.ALL}
|
||||||
} == 0L) {
|
else {
|
||||||
coroutineScope {
|
CacheType.NEW
|
||||||
launch {
|
}
|
||||||
albumCacheService.cacheAlbums(CacheType.ALL)
|
coroutineScope {
|
||||||
}
|
launch {
|
||||||
}
|
albumCacheService.cacheAlbums(cacheType)
|
||||||
} else {
|
|
||||||
coroutineScope {
|
|
||||||
launch {
|
|
||||||
albumCacheService.cacheAlbums(CacheType.NEW)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user