Skip to content

Commit e3e27fc

Browse files
committed
fix: coroutines dispatcher
1 parent ab473ef commit e3e27fc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/ControllerRuntime.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ControllerRuntime(
4747
private val pubSubServer = createPubSubGrpcServer()
4848

4949
suspend fun start() {
50+
logger.info("Starting controller")
5051
setupDatabase()
5152
startAuthServer()
5253
startPubSubGrpcServer()
@@ -67,7 +68,7 @@ class ControllerRuntime(
6768

6869
private fun startAuthServer() {
6970
logger.info("Starting auth server...")
70-
CoroutineScope(Dispatchers.Default).launch {
71+
CoroutineScope(Dispatchers.IO).launch {
7172
try {
7273
authServer.start()
7374
} catch (e: Exception) {
@@ -95,7 +96,7 @@ class ControllerRuntime(
9596

9697
private fun startGrpcServer() {
9798
logger.info("Starting gRPC server...")
98-
CoroutineScope(Dispatchers.Default).launch {
99+
CoroutineScope(Dispatchers.IO).launch {
99100
try {
100101
server.start()
101102
server.awaitTermination()
@@ -108,7 +109,7 @@ class ControllerRuntime(
108109

109110
private fun startPubSubGrpcServer() {
110111
logger.info("Starting pubsub gRPC server...")
111-
CoroutineScope(Dispatchers.Default).launch {
112+
CoroutineScope(Dispatchers.IO).launch {
112113
try {
113114
pubSubServer.start()
114115
pubSubServer.awaitTermination()
@@ -170,7 +171,7 @@ class ControllerRuntime(
170171
}
171172

172173
private fun startReconcilerJob(): Job {
173-
return CoroutineScope(Dispatchers.Default).launch {
174+
return CoroutineScope(Dispatchers.IO).launch {
174175
while (isActive) {
175176
reconciler.reconcile()
176177
delay(2000L)

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/YamlDirectoryRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ abstract class YamlDirectoryRepository<E, I>(
101101
StandardWatchEventKinds.ENTRY_MODIFY
102102
)
103103

104-
return CoroutineScope(Dispatchers.Default).launch {
104+
return CoroutineScope(Dispatchers.IO).launch {
105105
while (isActive) {
106106
val key = watchService.take()
107107
for (event in key.pollEvents()) {

0 commit comments

Comments
 (0)