Skip to content

Commit

Permalink
Do not complete on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
anotheroneofthese committed Aug 16, 2024
1 parent f5bd98a commit 28c1fd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class OrderService(val db: OrderRepository, val synqService: SynqOrderService) {
"Timed out while fetching from WLS database. Relevant payload: $payload"
}
}
.onErrorComplete(TimeoutException::class.java)
.awaitSingleOrNull()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProductService(val db: ProductRepository, val synqProductService: SynqProd
db.save(product)
.timeout(Duration.ofSeconds(6))
.onErrorMap {
throw ServerErrorException("Failed to save product in the database, but created in the storage system", it)
ServerErrorException("Failed to save product in the database, but created in the storage system", it)
}
.awaitSingle()

Expand Down Expand Up @@ -76,12 +76,11 @@ class ProductService(val db: ProductRepository, val synqProductService: SynqProd
// TODO - See if timeouts can be made configurable
return db.findByHostNameAndHostId(hostName, name)
.timeout(Duration.ofSeconds(8))
.doOnError {
if (it is TimeoutException) {
logger.error(it, { "Timed out while fetching from WLS database" })
.doOnError(TimeoutException::class.java) {
logger.error(it) {
"Timed out while fetching from WLS database"
}
}
.onErrorComplete(TimeoutException::class.java)
.awaitSingleOrNull()
}
}

0 comments on commit 28c1fd5

Please sign in to comment.