message_bus 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -4
- data/CHANGELOG +10 -0
- data/Dockerfile +2 -2
- data/README.md +1 -1
- data/lib/message_bus/backends/redis.rb +23 -1
- data/lib/message_bus/version.rb +1 -1
- data/lib/message_bus.rb +8 -3
- data/package-lock.json +82 -170
- data/spec/lib/message_bus/backend_spec.rb +0 -7
- data/spec/lib/message_bus_spec.rb +52 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f725f70ad14bdd643aea469118faba0c666f36c47ec6fc3b33dc3c2db85ee8fb
|
4
|
+
data.tar.gz: faf76a2ef12077e48890250b60572700076d0d9da317df2f91d96d49f514e002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73153925e4bd93e5dcc2b8d09c18b944f074bcac7b9de563923e7ac3abd0552951f89418f09d58682fa41748810491cb3e6cfbc24fef1c6f32c7b397724e8a5
|
7
|
+
data.tar.gz: 659ebc5f7c22af1ab1dbd23247896e51511394bdad062816bb25174f1fc5d8d474171fc4d8d2a7e989f2a6eda700e4fe38b8caa7bf575a70319e5d318ee18f9f
|
data/.github/workflows/ci.yml
CHANGED
@@ -43,7 +43,7 @@ jobs:
|
|
43
43
|
--health-retries 5
|
44
44
|
|
45
45
|
steps:
|
46
|
-
- uses: actions/checkout@
|
46
|
+
- uses: actions/checkout@v3
|
47
47
|
|
48
48
|
- uses: ruby/setup-ruby@v1
|
49
49
|
with:
|
@@ -51,9 +51,9 @@ jobs:
|
|
51
51
|
bundler-cache: true
|
52
52
|
|
53
53
|
- name: Set up Node.js
|
54
|
-
uses: actions/setup-node@
|
54
|
+
uses: actions/setup-node@v3
|
55
55
|
with:
|
56
|
-
node-version:
|
56
|
+
node-version: 18
|
57
57
|
cache: npm
|
58
58
|
|
59
59
|
- name: Setup npm
|
@@ -74,7 +74,7 @@ jobs:
|
|
74
74
|
runs-on: ubuntu-latest
|
75
75
|
|
76
76
|
steps:
|
77
|
-
- uses: actions/checkout@
|
77
|
+
- uses: actions/checkout@v3
|
78
78
|
|
79
79
|
- name: Release gem
|
80
80
|
uses: discourse/publish-rubygems-action@v2
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
FUTURE
|
2
|
+
|
3
|
+
04-11-2022
|
4
|
+
|
5
|
+
- Version 4.2.0
|
6
|
+
|
7
|
+
- FIX: Add redis gem version 5 support
|
8
|
+
- FEATURE: Allow disabling subscriptions without disabling publication
|
9
|
+
|
1
10
|
22-02-2022
|
2
11
|
|
3
12
|
- Version 4.2.0
|
@@ -376,6 +385,7 @@
|
|
376
385
|
|
377
386
|
- Version 2.0.0.beta.5
|
378
387
|
|
388
|
+
- Feature: Memory backend @jeremyevans
|
379
389
|
- Fix: JavaScript unsubscribe was not updating publicly visible MessageBus.callbacks @sam
|
380
390
|
- Fix: When MessageBus is talking to a readonly redis buffering may cause a infinite loop @tgxworld
|
381
391
|
|
data/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM ruby:2.
|
1
|
+
FROM ruby:2.7
|
2
2
|
|
3
3
|
RUN cd /tmp && \
|
4
4
|
wget --quiet https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
|
@@ -10,7 +10,7 @@ WORKDIR /usr/src/app
|
|
10
10
|
|
11
11
|
RUN mkdir -p ./lib/message_bus
|
12
12
|
COPY lib/message_bus/version.rb ./lib/message_bus
|
13
|
-
COPY Gemfile
|
13
|
+
COPY Gemfile *.gemspec ./
|
14
14
|
RUN bundle install
|
15
15
|
|
16
16
|
COPY . .
|
data/README.md
CHANGED
@@ -155,7 +155,7 @@ end)
|
|
155
155
|
|
156
156
|
#### Disabling message_bus
|
157
157
|
|
158
|
-
In certain cases, it is undesirable for message_bus to start up on application start, for example in a Rails application during the `db:create` rake task when using the Postgres backend (which will error trying to connect to the non-existent database to subscribe). You can invoke `MessageBus.off` before the middleware chain is loaded in order to prevent subscriptions and publications from happening; in a Rails app you might do this in an initializer based on some environment variable or some other conditional means.
|
158
|
+
In certain cases, it is undesirable for message_bus to start up on application start, for example in a Rails application during the `db:create` rake task when using the Postgres backend (which will error trying to connect to the non-existent database to subscribe). You can invoke `MessageBus.off` before the middleware chain is loaded in order to prevent subscriptions and publications from happening; in a Rails app you might do this in an initializer based on some environment variable or some other conditional means. If you want to just disable subscribing to the bus but want to continue to allow publications to be made, you can do `MessageBus.off(disable_publish: false)`.
|
159
159
|
|
160
160
|
### Debugging
|
161
161
|
|
@@ -346,7 +346,29 @@ LUA
|
|
346
346
|
private
|
347
347
|
|
348
348
|
def new_redis_connection
|
349
|
-
|
349
|
+
config = @redis_config.filter do |k, v|
|
350
|
+
# This is not ideal, required for Redis gem version 5
|
351
|
+
# redis-client no longer accepts arbitrary params
|
352
|
+
# anything unknown will error out.
|
353
|
+
# https://github.com/redis-rb/redis-client/blob/4c8e05acfb3477c1651138a4924616e79e6116f2/lib/redis_client/config.rb#L21-L39
|
354
|
+
#
|
355
|
+
#
|
356
|
+
# We should be doing the opposite and allowlisting params
|
357
|
+
# or splitting the object up. Starting with the smallest change that is backwards compatible
|
358
|
+
![
|
359
|
+
:backend,
|
360
|
+
:logger,
|
361
|
+
:long_polling_enabled,
|
362
|
+
:backend_options,
|
363
|
+
:base_route,
|
364
|
+
:client_message_filters,
|
365
|
+
:site_id_lookup,
|
366
|
+
:group_id_lookup,
|
367
|
+
:user_id_lookup,
|
368
|
+
:transport_codec
|
369
|
+
].include?(k)
|
370
|
+
end
|
371
|
+
::Redis.new(config)
|
350
372
|
end
|
351
373
|
|
352
374
|
# redis connection used for publishing messages
|
data/lib/message_bus/version.rb
CHANGED
data/lib/message_bus.rb
CHANGED
@@ -40,6 +40,7 @@ module MessageBus::Implementation
|
|
40
40
|
@config = {}
|
41
41
|
@mutex = Synchronizer.new
|
42
42
|
@off = false
|
43
|
+
@off_disable_publish = false
|
43
44
|
@destroyed = false
|
44
45
|
@timer_thread = nil
|
45
46
|
@subscriber_thread = nil
|
@@ -160,15 +161,17 @@ module MessageBus::Implementation
|
|
160
161
|
end
|
161
162
|
|
162
163
|
# Disables publication to the bus
|
164
|
+
# @param [Boolean] disable_publish Whether or not to disable publishing
|
163
165
|
# @return [void]
|
164
|
-
def off
|
166
|
+
def off(disable_publish: true)
|
165
167
|
@off = true
|
168
|
+
@off_disable_publish = disable_publish
|
166
169
|
end
|
167
170
|
|
168
171
|
# Enables publication to the bus
|
169
172
|
# @return [void]
|
170
173
|
def on
|
171
|
-
@destroyed = @off = false
|
174
|
+
@destroyed = @off = @off_disable_publish = false
|
172
175
|
end
|
173
176
|
|
174
177
|
# Overrides existing configuration
|
@@ -338,7 +341,7 @@ module MessageBus::Implementation
|
|
338
341
|
# @raise [MessageBus::InvalidMessage] if attempting to put permission restrictions on a globally-published message
|
339
342
|
# @raise [MessageBus::InvalidMessageTarget] if attempting to publish to a empty group of users
|
340
343
|
def publish(channel, data, opts = nil)
|
341
|
-
return if @
|
344
|
+
return if @off_disable_publish
|
342
345
|
|
343
346
|
@mutex.synchronize do
|
344
347
|
raise ::MessageBus::BusDestroyed if @destroyed
|
@@ -664,6 +667,8 @@ module MessageBus::Implementation
|
|
664
667
|
end
|
665
668
|
|
666
669
|
def subscribe_impl(channel, site_id, last_id, &blk)
|
670
|
+
return if @off
|
671
|
+
|
667
672
|
raise MessageBus::BusDestroyed if @destroyed
|
668
673
|
|
669
674
|
if last_id >= 0
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "message-bus-client",
|
3
|
-
"version": "
|
3
|
+
"version": "0.0.0-version-placeholder",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "message-bus-client",
|
9
|
-
"version": "
|
9
|
+
"version": "0.0.0-version-placeholder",
|
10
10
|
"license": "MIT",
|
11
11
|
"devDependencies": {
|
12
12
|
"eslint": "^7.27.0",
|
@@ -215,9 +215,9 @@
|
|
215
215
|
}
|
216
216
|
},
|
217
217
|
"node_modules/ansi-regex": {
|
218
|
-
"version": "5.0.
|
219
|
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.
|
220
|
-
"integrity": "sha512-
|
218
|
+
"version": "5.0.1",
|
219
|
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
220
|
+
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
221
221
|
"dev": true,
|
222
222
|
"engines": {
|
223
223
|
"node": ">=8"
|
@@ -263,9 +263,9 @@
|
|
263
263
|
}
|
264
264
|
},
|
265
265
|
"node_modules/async": {
|
266
|
-
"version": "
|
267
|
-
"resolved": "https://registry.npmjs.org/async/-/async-
|
268
|
-
"integrity": "
|
266
|
+
"version": "3.2.3",
|
267
|
+
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
268
|
+
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==",
|
269
269
|
"dev": true
|
270
270
|
},
|
271
271
|
"node_modules/balanced-match": {
|
@@ -491,12 +491,12 @@
|
|
491
491
|
"dev": true
|
492
492
|
},
|
493
493
|
"node_modules/ejs": {
|
494
|
-
"version": "3.1.
|
495
|
-
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.
|
496
|
-
"integrity": "sha512
|
494
|
+
"version": "3.1.8",
|
495
|
+
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz",
|
496
|
+
"integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==",
|
497
497
|
"dev": true,
|
498
498
|
"dependencies": {
|
499
|
-
"jake": "^10.
|
499
|
+
"jake": "^10.8.5"
|
500
500
|
},
|
501
501
|
"bin": {
|
502
502
|
"ejs": "bin/cli.js"
|
@@ -844,12 +844,33 @@
|
|
844
844
|
}
|
845
845
|
},
|
846
846
|
"node_modules/filelist": {
|
847
|
-
"version": "1.0.
|
848
|
-
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.
|
849
|
-
"integrity": "sha512-
|
847
|
+
"version": "1.0.4",
|
848
|
+
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
849
|
+
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
|
850
850
|
"dev": true,
|
851
851
|
"dependencies": {
|
852
|
-
"minimatch": "^
|
852
|
+
"minimatch": "^5.0.1"
|
853
|
+
}
|
854
|
+
},
|
855
|
+
"node_modules/filelist/node_modules/brace-expansion": {
|
856
|
+
"version": "2.0.1",
|
857
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
858
|
+
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
859
|
+
"dev": true,
|
860
|
+
"dependencies": {
|
861
|
+
"balanced-match": "^1.0.0"
|
862
|
+
}
|
863
|
+
},
|
864
|
+
"node_modules/filelist/node_modules/minimatch": {
|
865
|
+
"version": "5.0.1",
|
866
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
867
|
+
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
868
|
+
"dev": true,
|
869
|
+
"dependencies": {
|
870
|
+
"brace-expansion": "^2.0.1"
|
871
|
+
},
|
872
|
+
"engines": {
|
873
|
+
"node": ">=10"
|
853
874
|
}
|
854
875
|
},
|
855
876
|
"node_modules/finalhandler": {
|
@@ -1132,13 +1153,13 @@
|
|
1132
1153
|
"dev": true
|
1133
1154
|
},
|
1134
1155
|
"node_modules/jake": {
|
1135
|
-
"version": "10.8.
|
1136
|
-
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.
|
1137
|
-
"integrity": "sha512-
|
1156
|
+
"version": "10.8.5",
|
1157
|
+
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz",
|
1158
|
+
"integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==",
|
1138
1159
|
"dev": true,
|
1139
1160
|
"dependencies": {
|
1140
|
-
"async": "
|
1141
|
-
"chalk": "^
|
1161
|
+
"async": "^3.2.3",
|
1162
|
+
"chalk": "^4.0.2",
|
1142
1163
|
"filelist": "^1.0.1",
|
1143
1164
|
"minimatch": "^3.0.4"
|
1144
1165
|
},
|
@@ -1146,78 +1167,7 @@
|
|
1146
1167
|
"jake": "bin/cli.js"
|
1147
1168
|
},
|
1148
1169
|
"engines": {
|
1149
|
-
"node": "
|
1150
|
-
}
|
1151
|
-
},
|
1152
|
-
"node_modules/jake/node_modules/ansi-styles": {
|
1153
|
-
"version": "3.2.1",
|
1154
|
-
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
1155
|
-
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
1156
|
-
"dev": true,
|
1157
|
-
"dependencies": {
|
1158
|
-
"color-convert": "^1.9.0"
|
1159
|
-
},
|
1160
|
-
"engines": {
|
1161
|
-
"node": ">=4"
|
1162
|
-
}
|
1163
|
-
},
|
1164
|
-
"node_modules/jake/node_modules/chalk": {
|
1165
|
-
"version": "2.4.2",
|
1166
|
-
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
1167
|
-
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
1168
|
-
"dev": true,
|
1169
|
-
"dependencies": {
|
1170
|
-
"ansi-styles": "^3.2.1",
|
1171
|
-
"escape-string-regexp": "^1.0.5",
|
1172
|
-
"supports-color": "^5.3.0"
|
1173
|
-
},
|
1174
|
-
"engines": {
|
1175
|
-
"node": ">=4"
|
1176
|
-
}
|
1177
|
-
},
|
1178
|
-
"node_modules/jake/node_modules/color-convert": {
|
1179
|
-
"version": "1.9.3",
|
1180
|
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
1181
|
-
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
1182
|
-
"dev": true,
|
1183
|
-
"dependencies": {
|
1184
|
-
"color-name": "1.1.3"
|
1185
|
-
}
|
1186
|
-
},
|
1187
|
-
"node_modules/jake/node_modules/color-name": {
|
1188
|
-
"version": "1.1.3",
|
1189
|
-
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
1190
|
-
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
1191
|
-
"dev": true
|
1192
|
-
},
|
1193
|
-
"node_modules/jake/node_modules/escape-string-regexp": {
|
1194
|
-
"version": "1.0.5",
|
1195
|
-
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
1196
|
-
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
1197
|
-
"dev": true,
|
1198
|
-
"engines": {
|
1199
|
-
"node": ">=0.8.0"
|
1200
|
-
}
|
1201
|
-
},
|
1202
|
-
"node_modules/jake/node_modules/has-flag": {
|
1203
|
-
"version": "3.0.0",
|
1204
|
-
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
1205
|
-
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
1206
|
-
"dev": true,
|
1207
|
-
"engines": {
|
1208
|
-
"node": ">=4"
|
1209
|
-
}
|
1210
|
-
},
|
1211
|
-
"node_modules/jake/node_modules/supports-color": {
|
1212
|
-
"version": "5.5.0",
|
1213
|
-
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
1214
|
-
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
1215
|
-
"dev": true,
|
1216
|
-
"dependencies": {
|
1217
|
-
"has-flag": "^3.0.0"
|
1218
|
-
},
|
1219
|
-
"engines": {
|
1220
|
-
"node": ">=4"
|
1170
|
+
"node": ">=10"
|
1221
1171
|
}
|
1222
1172
|
},
|
1223
1173
|
"node_modules/jasmine-browser-runner": {
|
@@ -2258,9 +2208,9 @@
|
|
2258
2208
|
"dev": true
|
2259
2209
|
},
|
2260
2210
|
"ansi-regex": {
|
2261
|
-
"version": "5.0.
|
2262
|
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.
|
2263
|
-
"integrity": "sha512-
|
2211
|
+
"version": "5.0.1",
|
2212
|
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
2213
|
+
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
2264
2214
|
"dev": true
|
2265
2215
|
},
|
2266
2216
|
"ansi-styles": {
|
@@ -2294,9 +2244,9 @@
|
|
2294
2244
|
"dev": true
|
2295
2245
|
},
|
2296
2246
|
"async": {
|
2297
|
-
"version": "
|
2298
|
-
"resolved": "https://registry.npmjs.org/async/-/async-
|
2299
|
-
"integrity": "
|
2247
|
+
"version": "3.2.3",
|
2248
|
+
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
2249
|
+
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==",
|
2300
2250
|
"dev": true
|
2301
2251
|
},
|
2302
2252
|
"balanced-match": {
|
@@ -2480,12 +2430,12 @@
|
|
2480
2430
|
"dev": true
|
2481
2431
|
},
|
2482
2432
|
"ejs": {
|
2483
|
-
"version": "3.1.
|
2484
|
-
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.
|
2485
|
-
"integrity": "sha512
|
2433
|
+
"version": "3.1.8",
|
2434
|
+
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz",
|
2435
|
+
"integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==",
|
2486
2436
|
"dev": true,
|
2487
2437
|
"requires": {
|
2488
|
-
"jake": "^10.
|
2438
|
+
"jake": "^10.8.5"
|
2489
2439
|
}
|
2490
2440
|
},
|
2491
2441
|
"emoji-regex": {
|
@@ -2761,12 +2711,32 @@
|
|
2761
2711
|
}
|
2762
2712
|
},
|
2763
2713
|
"filelist": {
|
2764
|
-
"version": "1.0.
|
2765
|
-
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.
|
2766
|
-
"integrity": "sha512-
|
2714
|
+
"version": "1.0.4",
|
2715
|
+
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
2716
|
+
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
|
2767
2717
|
"dev": true,
|
2768
2718
|
"requires": {
|
2769
|
-
"minimatch": "^
|
2719
|
+
"minimatch": "^5.0.1"
|
2720
|
+
},
|
2721
|
+
"dependencies": {
|
2722
|
+
"brace-expansion": {
|
2723
|
+
"version": "2.0.1",
|
2724
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
2725
|
+
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
2726
|
+
"dev": true,
|
2727
|
+
"requires": {
|
2728
|
+
"balanced-match": "^1.0.0"
|
2729
|
+
}
|
2730
|
+
},
|
2731
|
+
"minimatch": {
|
2732
|
+
"version": "5.0.1",
|
2733
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
2734
|
+
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
2735
|
+
"dev": true,
|
2736
|
+
"requires": {
|
2737
|
+
"brace-expansion": "^2.0.1"
|
2738
|
+
}
|
2739
|
+
}
|
2770
2740
|
}
|
2771
2741
|
},
|
2772
2742
|
"finalhandler": {
|
@@ -2993,73 +2963,15 @@
|
|
2993
2963
|
"dev": true
|
2994
2964
|
},
|
2995
2965
|
"jake": {
|
2996
|
-
"version": "10.8.
|
2997
|
-
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.
|
2998
|
-
"integrity": "sha512-
|
2966
|
+
"version": "10.8.5",
|
2967
|
+
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz",
|
2968
|
+
"integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==",
|
2999
2969
|
"dev": true,
|
3000
2970
|
"requires": {
|
3001
|
-
"async": "
|
3002
|
-
"chalk": "^
|
2971
|
+
"async": "^3.2.3",
|
2972
|
+
"chalk": "^4.0.2",
|
3003
2973
|
"filelist": "^1.0.1",
|
3004
2974
|
"minimatch": "^3.0.4"
|
3005
|
-
},
|
3006
|
-
"dependencies": {
|
3007
|
-
"ansi-styles": {
|
3008
|
-
"version": "3.2.1",
|
3009
|
-
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
3010
|
-
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
3011
|
-
"dev": true,
|
3012
|
-
"requires": {
|
3013
|
-
"color-convert": "^1.9.0"
|
3014
|
-
}
|
3015
|
-
},
|
3016
|
-
"chalk": {
|
3017
|
-
"version": "2.4.2",
|
3018
|
-
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
3019
|
-
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
3020
|
-
"dev": true,
|
3021
|
-
"requires": {
|
3022
|
-
"ansi-styles": "^3.2.1",
|
3023
|
-
"escape-string-regexp": "^1.0.5",
|
3024
|
-
"supports-color": "^5.3.0"
|
3025
|
-
}
|
3026
|
-
},
|
3027
|
-
"color-convert": {
|
3028
|
-
"version": "1.9.3",
|
3029
|
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
3030
|
-
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
3031
|
-
"dev": true,
|
3032
|
-
"requires": {
|
3033
|
-
"color-name": "1.1.3"
|
3034
|
-
}
|
3035
|
-
},
|
3036
|
-
"color-name": {
|
3037
|
-
"version": "1.1.3",
|
3038
|
-
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
3039
|
-
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
3040
|
-
"dev": true
|
3041
|
-
},
|
3042
|
-
"escape-string-regexp": {
|
3043
|
-
"version": "1.0.5",
|
3044
|
-
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
3045
|
-
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
3046
|
-
"dev": true
|
3047
|
-
},
|
3048
|
-
"has-flag": {
|
3049
|
-
"version": "3.0.0",
|
3050
|
-
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
3051
|
-
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
3052
|
-
"dev": true
|
3053
|
-
},
|
3054
|
-
"supports-color": {
|
3055
|
-
"version": "5.5.0",
|
3056
|
-
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
3057
|
-
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
3058
|
-
"dev": true,
|
3059
|
-
"requires": {
|
3060
|
-
"has-flag": "^3.0.0"
|
3061
|
-
}
|
3062
|
-
}
|
3063
2975
|
}
|
3064
2976
|
},
|
3065
2977
|
"jasmine-browser-runner": {
|
@@ -392,11 +392,4 @@ describe BACKEND_CLASS do
|
|
392
392
|
got.map { |m| m.data }.must_equal ["12"]
|
393
393
|
end
|
394
394
|
|
395
|
-
it 'should not lose redis config' do
|
396
|
-
test_only :redis
|
397
|
-
redis_config = { connector: Redis::Client::Connector }
|
398
|
-
@bus.instance_variable_set(:@redis_config, redis_config)
|
399
|
-
@bus.send(:new_redis_connection)
|
400
|
-
expect(@bus.instance_variable_get(:@redis_config)[:connector]).must_equal Redis::Client::Connector
|
401
|
-
end
|
402
395
|
end
|
@@ -17,26 +17,6 @@ describe MessageBus do
|
|
17
17
|
@bus.destroy
|
18
18
|
end
|
19
19
|
|
20
|
-
it "can be turned off" do
|
21
|
-
@bus.off
|
22
|
-
|
23
|
-
@bus.off?.must_equal true
|
24
|
-
end
|
25
|
-
|
26
|
-
it "can call destroy multiple times" do
|
27
|
-
@bus.destroy
|
28
|
-
@bus.destroy
|
29
|
-
@bus.destroy
|
30
|
-
end
|
31
|
-
|
32
|
-
it "can be turned on after destroy" do
|
33
|
-
@bus.destroy
|
34
|
-
|
35
|
-
@bus.on
|
36
|
-
|
37
|
-
@bus.after_fork
|
38
|
-
end
|
39
|
-
|
40
20
|
it "destroying immediately after `after_fork` does not lock" do
|
41
21
|
10.times do
|
42
22
|
@bus.on
|
@@ -216,6 +196,58 @@ describe MessageBus do
|
|
216
196
|
@bus.backlog("/chuck").map { |i| i.data }.to_a.must_equal ['foo']
|
217
197
|
end
|
218
198
|
|
199
|
+
it "can be turned off" do
|
200
|
+
@bus.off
|
201
|
+
|
202
|
+
@bus.off?.must_equal true
|
203
|
+
|
204
|
+
@bus.publish("/chuck", "norris")
|
205
|
+
|
206
|
+
@bus.backlog("/chuck").to_a.must_equal []
|
207
|
+
end
|
208
|
+
|
209
|
+
it "can be turned off only for subscriptions" do
|
210
|
+
@bus.off(disable_publish: false)
|
211
|
+
|
212
|
+
@bus.off?.must_equal true
|
213
|
+
|
214
|
+
data = []
|
215
|
+
|
216
|
+
@bus.subscribe("/chuck") do |msg|
|
217
|
+
data << msg.data
|
218
|
+
end
|
219
|
+
|
220
|
+
@bus.publish("/chuck", "norris")
|
221
|
+
|
222
|
+
@bus.on
|
223
|
+
|
224
|
+
@bus.subscribe("/chuck") do |msg|
|
225
|
+
data << msg.data
|
226
|
+
end
|
227
|
+
|
228
|
+
@bus.publish("/chuck", "berry")
|
229
|
+
|
230
|
+
wait_for(2000) { data.length > 0 }
|
231
|
+
|
232
|
+
data.must_equal ["berry"]
|
233
|
+
|
234
|
+
@bus.backlog("/chuck").map(&:data).to_a.must_equal ["norris", "berry"]
|
235
|
+
end
|
236
|
+
|
237
|
+
it "can call destroy multiple times" do
|
238
|
+
@bus.destroy
|
239
|
+
@bus.destroy
|
240
|
+
@bus.destroy
|
241
|
+
end
|
242
|
+
|
243
|
+
it "can be turned on after destroy" do
|
244
|
+
@bus.destroy
|
245
|
+
|
246
|
+
@bus.on
|
247
|
+
|
248
|
+
@bus.after_fork
|
249
|
+
end
|
250
|
+
|
219
251
|
it "allows you to look up last_message" do
|
220
252
|
@bus.publish("/bob", "dylan")
|
221
253
|
@bus.publish("/bob", "marley")
|
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: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|