simplex-chat 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/simplex-chat/version.rb +1 -1
- data/lib/simplex-chat.rb +15 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1085de134ea131845256d9109e043629b6f83ab59adf94625c89287272c9966a
|
4
|
+
data.tar.gz: e2a1ac6403338b1cc07238d4dc6a2cdb15992a5e938b3df04c98d72d7cce3a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516773178824c494adaa70bef60b323774c8775456eeef1de33ca3bc2131073808d85db998ebade717254286374db2f25b8bec2ba4fd903502b229a70ecc2467
|
7
|
+
data.tar.gz: 9c4848683f657f145538979603d2d5edfa83e32aaf030b6422b5d60ca38613ff8a517abd30f800c508744e255f48d4a172fa4297e2d9ae7d2f55b6ef948db5e1
|
data/lib/simplex-chat/version.rb
CHANGED
data/lib/simplex-chat.rb
CHANGED
@@ -110,7 +110,13 @@ module SimpleXChat
|
|
110
110
|
# a chat message queue to insert one or
|
111
111
|
# more messages at a time, but poll just
|
112
112
|
# one at a time
|
113
|
-
|
113
|
+
# NOTE: We use non-blocking pop for thread safety
|
114
|
+
begin
|
115
|
+
chat_msg = @chat_message_queue.pop(true)
|
116
|
+
return chat_msg
|
117
|
+
rescue ThreadError
|
118
|
+
@logger.debug("Chat message queue is empty, waiting for new messages...")
|
119
|
+
end
|
114
120
|
|
115
121
|
loop do
|
116
122
|
msg = next_message
|
@@ -135,13 +141,20 @@ module SimpleXChat
|
|
135
141
|
end
|
136
142
|
|
137
143
|
@chat_message_queue.push chat_message
|
144
|
+
@logger.debug("Chat message pushed to queue: #{chat_message}")
|
138
145
|
end
|
139
146
|
|
140
147
|
# NOTE: Even after parsing the messages, the
|
141
148
|
# chat message queue can be empty because
|
142
149
|
# all the messages are too old, so we have
|
143
150
|
# to check again
|
144
|
-
|
151
|
+
begin
|
152
|
+
chat_msg = @chat_message_queue.pop(true)
|
153
|
+
@logger.debug("Chat message popped from queue")
|
154
|
+
return chat_msg
|
155
|
+
rescue ThreadError
|
156
|
+
@logger.debug("Chat message queue is still empty, waiting for new messages...")
|
157
|
+
end
|
145
158
|
end
|
146
159
|
|
147
160
|
nil
|