message_bus 3.3.1 → 3.3.6
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.
Potentially problematic release.
This version of message_bus might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.eslintrc.js +13 -0
- data/.github/workflows/ci.yml +54 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +3 -1
- data/CHANGELOG +47 -0
- data/DEV.md +9 -0
- data/Gemfile +2 -0
- data/README.md +30 -6
- data/Rakefile +1 -1
- data/assets/message-bus-ajax.js +1 -7
- data/assets/message-bus.js +72 -76
- data/bench/codecs/all_codecs.rb +39 -0
- data/bench/codecs/marshal.rb +11 -0
- data/bench/codecs/packed_string.rb +67 -0
- data/bench/codecs/string_hack.rb +47 -0
- data/bench/codecs_large_user_list.rb +29 -0
- data/bench/codecs_standard_message.rb +29 -0
- data/lib/message_bus.rb +51 -24
- data/lib/message_bus/backends/base.rb +0 -2
- data/lib/message_bus/backends/memory.rb +0 -2
- data/lib/message_bus/backends/postgres.rb +0 -2
- data/lib/message_bus/backends/redis.rb +3 -5
- data/lib/message_bus/client.rb +0 -1
- data/lib/message_bus/codec/base.rb +18 -0
- data/lib/message_bus/codec/json.rb +15 -0
- data/lib/message_bus/codec/oj.rb +21 -0
- data/lib/message_bus/distributed_cache.rb +7 -2
- data/lib/message_bus/message.rb +2 -2
- data/lib/message_bus/rack/middleware.rb +16 -16
- data/lib/message_bus/timer_thread.rb +8 -1
- data/lib/message_bus/version.rb +1 -1
- data/message_bus.gemspec +1 -1
- data/package-lock.json +2192 -0
- data/package.json +8 -3
- data/spec/lib/message_bus_spec.rb +34 -5
- metadata +20 -9
- data/.travis.yml +0 -17
- data/lib/message_bus/em_ext.rb +0 -6
data/package.json
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "message-bus-client",
|
3
|
-
"version": "3.3.
|
3
|
+
"version": "3.3.5",
|
4
4
|
"description": "A message bus client in Javascript",
|
5
5
|
"main": "assets/message-bus.js",
|
6
6
|
"keywords": "es6, modules",
|
7
|
-
"files": [
|
7
|
+
"files": [
|
8
|
+
"assets/message-bus.js"
|
9
|
+
],
|
8
10
|
"jsnext:main": "assets/message-bus.js",
|
9
11
|
"module": "assets/message-bus.js",
|
10
12
|
"repository": {
|
@@ -16,5 +18,8 @@
|
|
16
18
|
"bugs": {
|
17
19
|
"url": "https://github.com/discourse/message_bus/issues"
|
18
20
|
},
|
19
|
-
"homepage": "https://github.com/discourse/message_bus#readme"
|
21
|
+
"homepage": "https://github.com/discourse/message_bus#readme",
|
22
|
+
"devDependencies": {
|
23
|
+
"eslint": "^7.27.0"
|
24
|
+
}
|
20
25
|
}
|
@@ -162,7 +162,7 @@ describe MessageBus do
|
|
162
162
|
data.must_equal 'norris'
|
163
163
|
site_id.must_equal 'magic'
|
164
164
|
channel.must_equal '/chuck'
|
165
|
-
user_ids.must_equal [1, 2, 3]
|
165
|
+
user_ids.to_a.must_equal [1, 2, 3]
|
166
166
|
end
|
167
167
|
|
168
168
|
it "should get global messages if it subscribes to them" do
|
@@ -201,6 +201,13 @@ describe MessageBus do
|
|
201
201
|
@bus.backlog("/chuck").map { |i| i.data }.to_a.must_equal ['norris', 'foo']
|
202
202
|
end
|
203
203
|
|
204
|
+
it "should correctly restrict the backlog size of a channel" do
|
205
|
+
@bus.publish("/chuck", "norris")
|
206
|
+
@bus.publish("/chuck", "foo", max_backlog_size: 1)
|
207
|
+
|
208
|
+
@bus.backlog("/chuck").map { |i| i.data }.to_a.must_equal ['foo']
|
209
|
+
end
|
210
|
+
|
204
211
|
it "allows you to look up last_message" do
|
205
212
|
@bus.publish("/bob", "dylan")
|
206
213
|
@bus.publish("/bob", "marley")
|
@@ -266,15 +273,37 @@ describe MessageBus do
|
|
266
273
|
end
|
267
274
|
|
268
275
|
it "should exception if publishing restricted messages to user" do
|
269
|
-
|
276
|
+
assert_raises(MessageBus::InvalidMessage) do
|
270
277
|
@bus.publish("/global/test", "test", user_ids: [1])
|
271
|
-
end
|
278
|
+
end
|
272
279
|
end
|
273
280
|
|
274
281
|
it "should exception if publishing restricted messages to group" do
|
275
|
-
|
282
|
+
assert_raises(MessageBus::InvalidMessage) do
|
276
283
|
@bus.publish("/global/test", "test", user_ids: [1])
|
277
|
-
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should raise if we publish to an empty group or user list" do
|
288
|
+
assert_raises(MessageBus::InvalidMessageTarget) do
|
289
|
+
@bus.publish "/foo", "bar", user_ids: []
|
290
|
+
end
|
291
|
+
|
292
|
+
assert_raises(MessageBus::InvalidMessageTarget) do
|
293
|
+
@bus.publish "/foo", "bar", group_ids: []
|
294
|
+
end
|
295
|
+
|
296
|
+
assert_raises(MessageBus::InvalidMessageTarget) do
|
297
|
+
@bus.publish "/foo", "bar", client_ids: []
|
298
|
+
end
|
299
|
+
|
300
|
+
assert_raises(MessageBus::InvalidMessageTarget) do
|
301
|
+
@bus.publish "/foo", "bar", group_ids: [], user_ids: [1]
|
302
|
+
end
|
303
|
+
|
304
|
+
assert_raises(MessageBus::InvalidMessageTarget) do
|
305
|
+
@bus.publish "/foo", "bar", group_ids: [1], user_ids: []
|
306
|
+
end
|
278
307
|
end
|
279
308
|
end
|
280
309
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_bus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -59,10 +59,12 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".eslintrc.js"
|
63
|
+
- ".github/workflows/ci.yml"
|
62
64
|
- ".gitignore"
|
63
65
|
- ".rubocop.yml"
|
64
|
-
- ".travis.yml"
|
65
66
|
- CHANGELOG
|
67
|
+
- DEV.md
|
66
68
|
- Dockerfile
|
67
69
|
- Gemfile
|
68
70
|
- Guardfile
|
@@ -76,6 +78,12 @@ files:
|
|
76
78
|
- assets/message-bus.js
|
77
79
|
- assets/react-dom.js
|
78
80
|
- assets/react.js
|
81
|
+
- bench/codecs/all_codecs.rb
|
82
|
+
- bench/codecs/marshal.rb
|
83
|
+
- bench/codecs/packed_string.rb
|
84
|
+
- bench/codecs/string_hack.rb
|
85
|
+
- bench/codecs_large_user_list.rb
|
86
|
+
- bench/codecs_standard_message.rb
|
79
87
|
- docker-compose.yml
|
80
88
|
- examples/bench/bench.lua
|
81
89
|
- examples/bench/config.ru
|
@@ -98,10 +106,12 @@ files:
|
|
98
106
|
- lib/message_bus/backends/postgres.rb
|
99
107
|
- lib/message_bus/backends/redis.rb
|
100
108
|
- lib/message_bus/client.rb
|
109
|
+
- lib/message_bus/codec/base.rb
|
110
|
+
- lib/message_bus/codec/json.rb
|
111
|
+
- lib/message_bus/codec/oj.rb
|
101
112
|
- lib/message_bus/connection_manager.rb
|
102
113
|
- lib/message_bus/diagnostics.rb
|
103
114
|
- lib/message_bus/distributed_cache.rb
|
104
|
-
- lib/message_bus/em_ext.rb
|
105
115
|
- lib/message_bus/http_client.rb
|
106
116
|
- lib/message_bus/http_client/channel.rb
|
107
117
|
- lib/message_bus/http_client/version.rb
|
@@ -113,6 +123,7 @@ files:
|
|
113
123
|
- lib/message_bus/timer_thread.rb
|
114
124
|
- lib/message_bus/version.rb
|
115
125
|
- message_bus.gemspec
|
126
|
+
- package-lock.json
|
116
127
|
- package.json
|
117
128
|
- spec/assets/SpecHelper.js
|
118
129
|
- spec/assets/message-bus.spec.js
|
@@ -141,7 +152,7 @@ homepage: https://github.com/SamSaffron/message_bus
|
|
141
152
|
licenses:
|
142
153
|
- MIT
|
143
154
|
metadata: {}
|
144
|
-
post_install_message:
|
155
|
+
post_install_message:
|
145
156
|
rdoc_options: []
|
146
157
|
require_paths:
|
147
158
|
- lib
|
@@ -149,15 +160,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
160
|
requirements:
|
150
161
|
- - ">="
|
151
162
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
163
|
+
version: 2.4.0
|
153
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
165
|
requirements:
|
155
166
|
- - ">="
|
156
167
|
- !ruby/object:Gem::Version
|
157
168
|
version: '0'
|
158
169
|
requirements: []
|
159
|
-
rubygems_version: 3.1.
|
160
|
-
signing_key:
|
170
|
+
rubygems_version: 3.1.6
|
171
|
+
signing_key:
|
161
172
|
specification_version: 4
|
162
173
|
summary: ''
|
163
174
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
before_install: gem install bundler
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.4
|
5
|
-
- 2.5
|
6
|
-
- 2.6
|
7
|
-
gemfile:
|
8
|
-
- Gemfile
|
9
|
-
addons:
|
10
|
-
postgresql: "9.4"
|
11
|
-
env:
|
12
|
-
- PGUSER=postgres
|
13
|
-
before_script:
|
14
|
-
- psql -c 'create database message_bus_test;' -U postgres
|
15
|
-
services:
|
16
|
-
- redis-server
|
17
|
-
- postgresql
|