Skip to content

Commit

Permalink
⚗️ Increases timeout of rpc calls (ITISFoundation#6326)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov authored Sep 9, 2024
1 parent 9f06e36 commit 6d6f5c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/service-library/src/servicelib/rabbitmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ._client import RabbitMQClient
from ._client_rpc import RabbitMQRPCClient
from ._constants import BIND_TO_ALL_TOPICS
from ._constants import BIND_TO_ALL_TOPICS, RPC_REQUEST_DEFAULT_TIMEOUT_S
from ._errors import (
RemoteMethodNotRegisteredError,
RPCNotInitializedError,
Expand All @@ -17,6 +17,7 @@
"RabbitMQClient",
"RabbitMQRPCClient",
"RemoteMethodNotRegisteredError",
"RPC_REQUEST_DEFAULT_TIMEOUT_S",
"RPCNamespace",
"RPCNotInitializedError",
"RPCRouter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def _call(
user_id=user_id,
limit=limit,
offset=offset,
timeout_s=10 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
timeout_s=20 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)

result = await _call(
Expand Down Expand Up @@ -94,7 +94,7 @@ async def _call(
user_id=user_id,
service_key=service_key,
service_version=service_version,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
timeout_s=4 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)

result = await _call(
Expand Down
11 changes: 11 additions & 0 deletions services/web/server/src/simcore_service_webserver/payments/_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from models_library.wallets import WalletID
from pydantic import EmailStr, HttpUrl, parse_obj_as
from servicelib.logging_utils import log_decorator
from servicelib.rabbitmq import RPC_REQUEST_DEFAULT_TIMEOUT_S

from ..rabbitmq import get_rabbitmq_rpc_client

Expand Down Expand Up @@ -64,6 +65,7 @@ async def init_payment( # pylint: disable=too-many-arguments
stripe_price_id=stripe_price_id,
stripe_tax_rate_id=stripe_tax_rate_id,
comment=comment,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert isinstance(result, WalletPaymentInitiated) # nosec
return result
Expand All @@ -85,6 +87,7 @@ async def cancel_payment(
payment_id=payment_id,
user_id=user_id,
wallet_id=wallet_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)


Expand All @@ -106,6 +109,7 @@ async def get_payments_page(
product_name=product_name,
limit=limit,
offset=offset,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert ( # nosec
parse_obj_as(tuple[int, list[PaymentTransaction]], result) is not None
Expand All @@ -129,6 +133,7 @@ async def get_payment_invoice_url(
user_id=user_id,
wallet_id=wallet_id,
payment_id=payment_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
return result

Expand All @@ -153,6 +158,7 @@ async def init_creation_of_payment_method(
user_id=user_id,
user_name=user_name,
user_email=user_email,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert isinstance(result, PaymentMethodInitiated) # nosec
return result
Expand All @@ -174,6 +180,7 @@ async def cancel_creation_of_payment_method(
payment_method_id=payment_method_id,
user_id=user_id,
wallet_id=wallet_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert result is None # nosec

Expand All @@ -192,6 +199,7 @@ async def list_payment_methods(
parse_obj_as(RPCMethodName, "list_payment_methods"),
user_id=user_id,
wallet_id=wallet_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert isinstance(result, list) # nosec
return result
Expand All @@ -213,6 +221,7 @@ async def get_payment_method(
payment_method_id=payment_method_id,
user_id=user_id,
wallet_id=wallet_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert isinstance(result, PaymentMethodGet) # nosec
return result
Expand All @@ -234,6 +243,7 @@ async def delete_payment_method(
payment_method_id=payment_method_id,
user_id=user_id,
wallet_id=wallet_id,
timeout_s=2 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)
assert result is None # nosec

Expand Down Expand Up @@ -274,6 +284,7 @@ async def pay_with_payment_method( # noqa: PLR0913 # pylint: disable=too-many-a
stripe_price_id=stripe_price_id,
stripe_tax_rate_id=stripe_tax_rate_id,
comment=comment,
timeout_s=3 * RPC_REQUEST_DEFAULT_TIMEOUT_S,
)

assert isinstance(result, PaymentTransaction) # nosec
Expand Down

0 comments on commit 6d6f5c5

Please sign in to comment.