Skip to content

Commit

Permalink
fix: respect timeout setting in grpc method calls (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Bond <federicobond@gmail.com>
  • Loading branch information
federicobond authored Feb 24, 2024
1 parent 6508234 commit 0149cf7
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,32 +133,33 @@ def _resolve(
evaluation_context: EvaluationContext,
):
context = self._convert_context(evaluation_context)
call_args = {"timeout": self.timeout}
try:
if flag_type == FlagType.BOOLEAN:
request = schema_pb2.ResolveBooleanRequest(
flag_key=flag_key, context=context
)
response = self.stub.ResolveBoolean(request)
response = self.stub.ResolveBoolean(request, **call_args)
elif flag_type == FlagType.STRING:
request = schema_pb2.ResolveStringRequest(
flag_key=flag_key, context=context
)
response = self.stub.ResolveString(request)
response = self.stub.ResolveString(request, **call_args)
elif flag_type == FlagType.OBJECT:
request = schema_pb2.ResolveObjectRequest(
flag_key=flag_key, context=context
)
response = self.stub.ResolveObject(request)
response = self.stub.ResolveObject(request, **call_args)
elif flag_type == FlagType.FLOAT:
request = schema_pb2.ResolveFloatRequest(
flag_key=flag_key, context=context
)
response = self.stub.ResolveFloat(request)
response = self.stub.ResolveFloat(request, **call_args)
elif flag_type == FlagType.INTEGER:
request = schema_pb2.ResolveIntRequest(
flag_key=flag_key, context=context
)
response = self.stub.ResolveInt(request)
response = self.stub.ResolveInt(request, **call_args)
else:
raise ValueError(f"Unknown flag type: {flag_type}")

Expand Down

0 comments on commit 0149cf7

Please sign in to comment.