Skip to content

Commit ba8b793

Browse files
authored
Removing duplicate check for whether the grpc handle has been initialized (#95)
- Only need one check for this and the new one is better, so remove the old - Don't use isready function name for grpc handle running check, this is a special case
1 parent 1ee5577 commit ba8b793

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/Curl.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,23 +239,13 @@ mutable struct gRPCRequest
239239
max_send_message_length = 4 * 1024 * 1024,
240240
max_recieve_message_length = 4 * 1024 * 1024,
241241
)
242-
!isready(grpc) && throw(
242+
!grpc.running && throw(
243243
gRPCServiceCallException(
244244
GRPC_FAILED_PRECONDITION,
245245
"gRPCCURL backend is not running, did you forget to call grpc_init()?",
246246
),
247247
)
248248

249-
# If the grpc handle is shutdown avoid acquiring the request semaphore and immediately throw an exception
250-
if !grpc.running
251-
throw(
252-
gRPCServiceCallException(
253-
GRPC_FAILED_PRECONDITION,
254-
"Tried to make a request when the provided grpc handle is shutdown",
255-
),
256-
)
257-
end
258-
259249
# Reduce number of available requests by one or block if its currently zero
260250
# Also reduces the need to allocate the curl_done_reading Event for every request
261251
# This is a 7% reduction in allocations overall
@@ -798,7 +788,6 @@ function Base.open(grpc::gRPCCURL)
798788
end
799789
end
800790

801-
isready(grpc::gRPCCURL) = grpc.running
802791

803792
max_reqs_dec(grpc::gRPCCURL) = take!(grpc.sem)
804793
function max_reqs_inc(grpc::gRPCCURL, req::gRPCRequest)

0 commit comments

Comments
 (0)