Skip to content

Commit ad0341d

Browse files
authored
Merge pull request #30 from simplecloudapp/fix_group_deletion
fix: groups are not being deleted anymore
2 parents 2660ec8 + 3238f97 commit ad0341d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ abstract class YamlDirectoryRepository<E, I>(
140140
if (entity != null) {
141141
watcherEvents.onDelete(entity)
142142
}
143-
deleteFile(resolvedPath.toFile())
144143
}
145144
}
146145
}

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/server/ServerRepository.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ class ServerRepository(
2222
) : LoadableRepository<Server, String> {
2323

2424
override suspend fun find(identifier: String): Server? {
25-
return database.context.selectFrom(CLOUD_SERVERS)
25+
return database.context.selectFrom(CLOUD_SERVERS)
2626
.where(CLOUD_SERVERS.UNIQUE_ID.eq(identifier))
2727
.limit(1)
2828
.awaitFirstOrNull()
2929
?.let { record -> mapCloudServersRecordToServer(record) }
3030
}
3131

32-
3332
suspend fun findServerByNumerical(group: String, id: Int): Server? {
3433
return database.context.selectFrom(CLOUD_SERVERS)
3534
.where(
@@ -121,7 +120,6 @@ class ServerRepository(
121120
}
122121
}
123122

124-
@Synchronized
125123
override fun save(element: Server) {
126124
numericalIdRepository.saveNumericalId(element.group, element.numericalId)
127125

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/server/ServerService.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ServerService(
6060
return stopServer(server.toDefinition(), request.stopCause)
6161
} catch (e: Exception) {
6262
throw StatusException(
63-
Status.INTERNAL.withDescription("Error occured whilest cleaning up stopped server: ").withCause(e)
63+
Status.INTERNAL.withDescription("Error occurred whilst cleaning up stopped server: ").withCause(e)
6464
)
6565
}
6666
}
@@ -216,7 +216,9 @@ class ServerService(
216216
startedServers.add(server)
217217
}
218218
} catch (e: Exception) {
219-
throw StatusException(Status.INTERNAL.withDescription("Error whilst starting multiple servers").withCause(e))
219+
throw StatusException(
220+
Status.INTERNAL.withDescription("Error whilst starting multiple servers").withCause(e)
221+
)
220222
}
221223

222224
return StartMultipleServerResponse.newBuilder()
@@ -245,7 +247,6 @@ class ServerService(
245247
val server = buildServer(group, numericalId)
246248
serverRepository.save(server)
247249
val stub = host.stub ?: throw StatusException(Status.INTERNAL.withDescription("Server host has no stub"))
248-
serverRepository.save(server)
249250
try {
250251
val result = stub.startServer(
251252
ServerHostStartServerRequest.newBuilder()
@@ -263,7 +264,7 @@ class ServerService(
263264
}
264265
}
265266

266-
private suspend fun publishServerStartEvents(server: ServerDefinition, startCause: ServerStartCause) {
267+
private fun publishServerStartEvents(server: ServerDefinition, startCause: ServerStartCause) {
267268
pubSubClient.publish(
268269
"event", ServerStartEvent.newBuilder()
269270
.setServer(server)
@@ -380,7 +381,7 @@ class ServerService(
380381

381382
try {
382383
timeout?.let {
383-
group.timeout = GroupTimeout(it);
384+
group.timeout = GroupTimeout(it)
384385
}
385386

386387
groupServers.forEach { server ->

0 commit comments

Comments
 (0)