Skip to content

Commit

Permalink
Remove useless exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemyev Vyacheslav authored and Artemyev Vyacheslav committed Nov 2, 2023
1 parent 059b025 commit ffe96ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
14 changes: 0 additions & 14 deletions src/main/kotlin/com/viartemev/thewhiterabbit/common/Utlis.kt

This file was deleted.

17 changes: 7 additions & 10 deletions src/main/kotlin/com/viartemev/thewhiterabbit/rpc/RpcClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.viartemev.thewhiterabbit.rpc

import com.rabbitmq.client.Channel
import com.viartemev.thewhiterabbit.common.RabbitMqMessage
import com.viartemev.thewhiterabbit.common.cancelOnIOException
import com.viartemev.thewhiterabbit.queue.DeleteQueueSpecification
import com.viartemev.thewhiterabbit.queue.declareQueue
import com.viartemev.thewhiterabbit.queue.deleteQueue
Expand Down Expand Up @@ -36,15 +35,13 @@ class RpcClient(val channel: Channel) {
var consumerTag: String? = null
try {
return suspendCancellableCoroutine { continuation ->
cancelOnIOException(continuation) {
consumerTag = channel.basicConsume(replyQueueName, true, { _, delivery ->
if (corrId == delivery.properties.correlationId) {
continuation.resume(RabbitMqMessage(delivery.properties, delivery.body))
}
}, { consumerTag ->
logger.debug { "Consumer $consumerTag has been cancelled for reasons other than by a call to Channel#basicCancel" }
})
}
consumerTag = channel.basicConsume(replyQueueName, true, { _, delivery ->
if (corrId == delivery.properties.correlationId) {
continuation.resume(RabbitMqMessage(delivery.properties, delivery.body))
}
}, { consumerTag ->
logger.debug { "Consumer $consumerTag has been cancelled for reasons other than by a call to Channel#basicCancel" }
})
}
} finally {
try {
Expand Down

0 comments on commit ffe96ef

Please sign in to comment.