Skip to content

Commit

Permalink
Handle the failure of updating to a clean coordinate name
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOltmann committed Nov 6, 2024
1 parent bec345d commit c62d52e
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/main/kotlin/Routings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,24 @@ private suspend fun handleGetRequestedCoordinate(
*/
if (coordinate != cleanCoordinate) {

collection.updateOne(
Filters.eq(RequestedCoordinate::coordinate.name, coordinate),
Updates.set(RequestedCoordinate::coordinate.name, cleanCoordinate)
)
try {

collection.updateOne(
Filters.eq(RequestedCoordinate::coordinate.name, coordinate),
Updates.set(RequestedCoordinate::coordinate.name, cleanCoordinate)
)

} catch (ex: Exception) {

/* If we can't update to the new name, the request already existed and is duplicated. */

collection.updateOne(
Filters.eq(RequestedCoordinate::coordinate.name, coordinate),
Updates.set(RequestedCoordinate::status.name, RequestedCoordinateStatus.DUPLICATED)
)

continue@findseed
}
}

val existingWorld: Cluster? = database
Expand Down

0 comments on commit c62d52e

Please sign in to comment.