Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% CPU usage when subscribe to Queries or Commands #51

Open
sa4zet opened this issue Mar 8, 2023 · 1 comment
Open

100% CPU usage when subscribe to Queries or Commands #51

sa4zet opened this issue Mar 8, 2023 · 1 comment

Comments

@sa4zet
Copy link

sa4zet commented Mar 8, 2023

How to reproduce:

  1. start a kubemq server
  2. run the following python code:
import logging
from typing import Optional

from kubemq.commandquery import Responder, RequestReceive, Response
from kubemq.subscription import SubscribeRequest, SubscribeType, EventsStoreType
from kubemq.tools import ListenerCancellationToken


def message_handler(request: RequestReceive) -> Optional[Response]:
    if request is None:
        return None
    response = Response(request)
    response.request_id = request.request_id
    response.reply_channel = request.reply_channel
    return response


def error_handler(error: str) -> None:
    logging.error(error)


if __name__ == "__main__":
    cancellation_token = ListenerCancellationToken()
    responder = Responder(kubemq_address="kubemq:50000")
    subscribe_request = SubscribeRequest(
        channel="channel_name",
        client_id="client",
        events_store_type=EventsStoreType.Undefined,
        events_store_type_value=0,
        subscribe_type=SubscribeType.Queries
    )
    responder.subscribe_to_requests(
        subscribe_request=subscribe_request,
        handler=message_handler,
        error_handler=error_handler,
        listener_cancellation_token=cancellation_token
    )
    input("press enter to end receiving messages")

image

Environment:

  • kubemq community edition version: v2.3.7
  • Python 3.11.2
  • kubemq==2.3.0
@sa4zet sa4zet changed the title 100% CPU usage when subsribe to Queries or Commands 100% CPU usage when subscribe to Queries or Commands Mar 8, 2023
@celebgnu
Copy link

Any updates on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants