You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm around an issue which I'm not sure if it's related how I use the lib or something else on its internals.
By trying the following process:
@mqtt_client = PahoMqtt::Client.new(
client_id: client_id,
username: username,
password: password
)
@mqtt_client.connect(
host=@mqtt_host,
port=@mqtt_port,
keep_alive=60,
persistent=true
)
@mqtt_client.subscribe(['v1/some_topic'], 1)
@mqtt_client.on_message do |message|
# print the retained/received message
end
At first, it will print all retained messages on the broker, around ~80 on ours. It takes 10 seconds to load all 80 retained messages, which it seems to be very slow on our requirements.
Then I changed to use the foreground alternative.
@mqtt_client.connect(
host=@mqtt_host,
port=@mqtt_port,
keep_alive=60,
persistent=true ,
blocking=true
)
def foreground_mode
[:loop_read, :loop_write, :loop_misc].each do |method|
Thread.new do
while @mqtt_client.connected? do
@mqtt_client.send(method)
end
end
end
end
# will spawn a different Thread for each loop
foreground_mode
Even so, this solution is even worse, taking 40 seconds, and I think it's related to the GIL maybe.
In addition, I compared along with the paho.mqtt.python lib, which in turn takes just 1 second instead to load all 80 retained messages. I'd gently ask you guys for some clue, am I missing something, some tweak to be made, already an known issue?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hey!
I'm around an issue which I'm not sure if it's related how I use the lib or something else on its internals.
By trying the following process:
At first, it will print all retained messages on the broker, around ~80 on ours.
It takes 10 seconds to load all 80 retained messages
, which it seems to be very slow on our requirements.Then I changed to use the
foreground
alternative.Even so, this solution is even worse, taking
40 seconds
, and I think it's related to theGIL
maybe.In addition, I compared along with the paho.mqtt.python lib, which in turn takes just
1 second
instead to load all 80 retained messages. I'd gently ask you guys for some clue, am I missing something, some tweak to be made, already an known issue?Thanks in advance!
The text was updated successfully, but these errors were encountered: