cpee 2.0.19 → 2.0.20
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/cockpit/css/wfadaptor.css +17 -0
- data/cockpit/js/instance.js +0 -1
- data/cockpit/js_libs.zip +0 -0
- data/cockpit/themes/model/rngs/call.rng +2 -1
- data/cockpit/themes/model/rngs/callmanipulate.rng +2 -1
- data/cockpit/themes/model/theme.js +1 -1
- data/cpee.gemspec +2 -2
- data/lib/cpee/controller.rb +6 -3
- data/lib/cpee/implementation.rb +23 -8
- data/lib/cpee/implementation_notifications.rb +1 -1
- data/lib/cpee/persistence.rb +2 -1
- data/lib/cpee/redis.rb +57 -0
- data/server/routing/end.rb +16 -4
- data/server/routing/forward-events.rb +19 -7
- data/server/routing/forward-votes.rb +19 -7
- data/server/routing/persist.rb +26 -14
- data/tools/cpee +5 -5
- data/tools/test/README +4 -0
- data/tools/test/config.json +3 -0
- data/tools/test/contrib/graph_example.svg +1166 -0
- data/tools/test/contrib/legend.svg +817 -0
- data/tools/test/contrib/symbols.svg +224 -0
- data/tools/test/contrib/transformation1.xsl +264 -0
- data/tools/test/contrib/transformation2.xsl +10 -0
- data/tools/test/contrib/tree_example.svg +788 -0
- data/tools/test/css/model.css +24 -0
- data/tools/test/css/track.css +60 -0
- data/tools/test/css/ui.css +214 -0
- data/tools/test/css/wfadaptor.css +422 -0
- data/tools/test/edit.html +258 -0
- data/tools/test/graph.html +69 -0
- data/tools/test/index.html +258 -0
- data/tools/test/js/details.js +109 -0
- data/tools/test/js/instance.js +1344 -0
- data/tools/test/js/model.js +41 -0
- data/tools/test/js/parameters.js +82 -0
- data/tools/test/js/track.js +18 -0
- data/tools/test/js/ui.js +104 -0
- data/tools/test/js/wfadaptor.js +763 -0
- data/tools/test/js_libs.zip +0 -0
- data/tools/test/js_libs/Makefile +2 -0
- data/tools/test/js_libs/ansi_up.js +333 -0
- data/tools/test/js_libs/console.js +80 -0
- data/tools/test/js_libs/custommenu.css +84 -0
- data/tools/test/js_libs/custommenu.js +104 -0
- data/tools/test/js_libs/experiments1/relaxngui.css +185 -0
- data/tools/test/js_libs/experiments1/relaxngui.js +488 -0
- data/tools/test/js_libs/experiments1/rngtest9.html +60 -0
- data/tools/test/js_libs/experiments1/rngtest9.rng +35 -0
- data/tools/test/js_libs/experiments1/rngtest9.xml +8 -0
- data/tools/test/js_libs/jquery-2.2.4.min.js +4 -0
- data/tools/test/js_libs/jquery-3.2.1.min.js +4 -0
- data/tools/test/js_libs/jquery-3.3.1.min.js +2 -0
- data/tools/test/js_libs/jquery.browser.js +40 -0
- data/tools/test/js_libs/jquery.caret.min.js +10 -0
- data/tools/test/js_libs/jquery.cookie.js +117 -0
- data/tools/test/js_libs/jquery.min.js +1 -0
- data/tools/test/js_libs/jquery.svg.min.js +6 -0
- data/tools/test/js_libs/jquery.svgdom.min.js +6 -0
- data/tools/test/js_libs/markdown.min.js +1 -0
- data/tools/test/js_libs/parsequery.js +21 -0
- data/tools/test/js_libs/printf.js +368 -0
- data/tools/test/js_libs/relaxngui.css +213 -0
- data/tools/test/js_libs/relaxngui.js +543 -0
- data/tools/test/js_libs/strftime.min.js +1 -0
- data/tools/test/js_libs/tests/dataelements.html +59 -0
- data/tools/test/js_libs/tests/dataelements.rng +8 -0
- data/tools/test/js_libs/tests/dataelements.xml +3 -0
- data/tools/test/js_libs/tests/relaxngui.css +203 -0
- data/tools/test/js_libs/tests/relaxngui.js +502 -0
- data/tools/test/js_libs/tests/rngtest1.html +66 -0
- data/tools/test/js_libs/tests/rngtest1.rng +147 -0
- data/tools/test/js_libs/tests/rngtest1.xml +13 -0
- data/tools/test/js_libs/tests/rngtest2.html +60 -0
- data/tools/test/js_libs/tests/rngtest2.rng +6 -0
- data/tools/test/js_libs/tests/rngtest2.xml +3 -0
- data/tools/test/js_libs/tests/rngtest3.html +60 -0
- data/tools/test/js_libs/tests/rngtest3.rng +23 -0
- data/tools/test/js_libs/tests/rngtest3.xml +9 -0
- data/tools/test/js_libs/tests/rngtest4.html +60 -0
- data/tools/test/js_libs/tests/rngtest4.rng +19 -0
- data/tools/test/js_libs/tests/rngtest4.xml +12 -0
- data/tools/test/js_libs/tests/rngtest5.html +60 -0
- data/tools/test/js_libs/tests/rngtest5.rng +75 -0
- data/tools/test/js_libs/tests/rngtest5.xml +40 -0
- data/tools/test/js_libs/tests/rngtest6.html +60 -0
- data/tools/test/js_libs/tests/rngtest6.rng +24 -0
- data/tools/test/js_libs/tests/rngtest6.xml +6 -0
- data/tools/test/js_libs/tests/rngtest8.html +60 -0
- data/tools/test/js_libs/tests/rngtest8.rng +13 -0
- data/tools/test/js_libs/tests/rngtest8.xml +2 -0
- data/tools/test/js_libs/tests/rngtest9.html +60 -0
- data/tools/test/js_libs/tests/rngtest9.rng +31 -0
- data/tools/test/js_libs/tests/rngtest9.xml +8 -0
- data/tools/test/js_libs/ui.css +333 -0
- data/tools/test/js_libs/ui.html +168 -0
- data/tools/test/js_libs/ui.js +177 -0
- data/tools/test/js_libs/underscore.min.js +27 -0
- data/tools/test/js_libs/util.js +81 -0
- data/tools/test/js_libs/vkbeautify.0.99.00.beta.js +358 -0
- data/tools/test/js_libs/vkbeautify.js +1 -0
- data/tools/test/js_libs/webcomponents.min.js +196 -0
- data/tools/test/model.html +192 -0
- data/tools/test/rngs/attributes.rng +8 -0
- data/tools/test/rngs/dataelements.rng +8 -0
- data/tools/test/rngs/endpoints.rng +8 -0
- data/tools/test/templates.legacy/Async.xml +46 -0
- data/tools/test/templates.legacy/BCO.xml +70 -0
- data/tools/test/templates.legacy/BCS.xml +70 -0
- data/tools/test/templates.legacy/Centurio.xml +75 -0
- data/tools/test/templates.legacy/Concurrent.xml +40 -0
- data/tools/test/templates.legacy/Coopis Testset.xml +76 -0
- data/tools/test/templates.legacy/Endpoints and Data Manipulation.xml +30 -0
- data/tools/test/templates.legacy/ICSOC Testset.xml +95 -0
- data/tools/test/templates.legacy/Infinity.xml +28 -0
- data/tools/test/templates.legacy/Lego Boxer.xml +31 -0
- data/tools/test/templates.legacy/Lego Conveyor.xml +31 -0
- data/tools/test/templates.legacy/Lego Crane.xml +87 -0
- data/tools/test/templates.legacy/Lego Ejector.xml +55 -0
- data/tools/test/templates.legacy/Lego Full.xml +142 -0
- data/tools/test/templates.legacy/Lego Liddy.xml +40 -0
- data/tools/test/templates.legacy/Lego Plate.xml +31 -0
- data/tools/test/templates.legacy/Lego Transporter.xml +43 -0
- data/tools/test/templates.legacy/Lego_Part_1.xml +85 -0
- data/tools/test/templates.legacy/LgLinear.xml +65 -0
- data/tools/test/templates.legacy/Linear.xml +77 -0
- data/tools/test/templates.legacy/Log.xml +117 -0
- data/tools/test/templates.legacy/Mangler 1.xml +87 -0
- data/tools/test/templates.legacy/Mangler 2.xml +103 -0
- data/tools/test/templates.legacy/Manuel Labels.xml +55 -0
- data/tools/test/templates.legacy/Promise.xml +275 -0
- data/tools/test/templates.legacy/SOPROMO Test Sonification.xml +83 -0
- data/tools/test/templates.legacy/Subprocess.xml +56 -0
- data/tools/test/templates.legacy/Syncing P34 1.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 2.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 3.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34.xml +77 -0
- data/tools/test/templates.legacy/TEST - Bad Loop.xml +173 -0
- data/tools/test/templates.legacy/TEST - Wrong Positions.xml +174 -0
- data/tools/test/templates.legacy/Take_5.xml +48 -0
- data/tools/test/templates.legacy/Update.xml +32 -0
- data/tools/test/templates.legacy/Worklist Parallel.xml +104 -0
- data/tools/test/templates.legacy/Worklist Test CPEE.xml +40 -0
- data/tools/test/templates.legacy/Worklist Test.xml +42 -0
- data/tools/test/templates.legacy/Worklist Test2.xml +43 -0
- data/tools/test/templates.legacy/convert_cpee2.rb +15 -0
- data/tools/test/templates.legacy/convert_preset.rb +32 -0
- data/tools/test/templates.legacy/testsets.xml +37 -0
- data/tools/test/templates.legacy/transformations.xml +4 -0
- data/tools/test/templates/Coopis 2010.xml +76 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
- data/tools/test/templates/Track Test Local.xml +82 -0
- data/tools/test/templates/Track Test.xml +82 -0
- data/tools/test/templates/UR-VUE 2020 Manual Adjust.xml +182 -0
- data/tools/test/templates/UR-VUE 2020 Solution Baseline.xml +203 -0
- data/tools/test/templates/UR-VUE 2020 Solution NN.xml +197 -0
- data/tools/test/templates/UR-VUE 2020 Solution View.xml +151 -0
- data/tools/test/templates/UR-VUE 2020.xml +26 -0
- data/tools/test/templates/Worklist.xml +42 -0
- data/tools/test/templates/instantiate.local/Take_Sub.xml +59 -0
- data/tools/test/templates/instantiate/Take_Perf.xml +46 -0
- data/tools/test/templates/instantiate/Take_Sub.xml +58 -0
- data/tools/test/templates/instantiate/Take_X.xml +48 -0
- data/tools/test/themes/compact/theme.js +1285 -0
- data/tools/test/themes/diana/theme.js +1650 -0
- data/tools/test/themes/extended/theme.js +1325 -0
- data/tools/test/themes/model/rngs/alternative.rng +1 -0
- data/tools/test/themes/model/rngs/call.rng +67 -0
- data/tools/test/themes/model/rngs/callmanipulate.rng +72 -0
- data/tools/test/themes/model/rngs/choose.rng +1 -0
- data/tools/test/themes/model/rngs/critical.rng +1 -0
- data/tools/test/themes/model/rngs/escape.rng +1 -0
- data/tools/test/themes/model/rngs/group.rng +1 -0
- data/tools/test/themes/model/rngs/loop.rng +1 -0
- data/tools/test/themes/model/rngs/manipulate.rng +1 -0
- data/tools/test/themes/model/rngs/otherwise.rng +1 -0
- data/tools/test/themes/model/rngs/parallel.rng +1 -0
- data/tools/test/themes/model/rngs/parallel_branch.rng +1 -0
- data/tools/test/themes/model/rngs/scripts.rng +7 -0
- data/tools/test/themes/model/rngs/stop.rng +1 -0
- data/tools/test/themes/model/rngs/terminate.rng +1 -0
- data/tools/test/themes/model/theme.js +1268 -0
- data/tools/test/themes/packed/theme.js +1286 -0
- data/tools/test/themes/preset/rngs/alternative.rng +25 -0
- data/tools/test/themes/preset/rngs/call.rng +122 -0
- data/tools/test/themes/preset/rngs/callmanipulate.rng +145 -0
- data/tools/test/themes/preset/rngs/choose.rng +14 -0
- data/tools/test/themes/preset/rngs/closed_loop.rng +62 -0
- data/tools/test/themes/preset/rngs/closed_loop_cancel.rng +5 -0
- data/tools/test/themes/preset/rngs/closed_loop_control.rng +31 -0
- data/tools/test/themes/preset/rngs/closed_loop_measuring.rng +12 -0
- data/tools/test/themes/preset/rngs/critical.rng +5 -0
- data/tools/test/themes/preset/rngs/escape.rng +1 -0
- data/tools/test/themes/preset/rngs/group.rng +3 -0
- data/tools/test/themes/preset/rngs/loop.rng +22 -0
- data/tools/test/themes/preset/rngs/manipulate.rng +9 -0
- data/tools/test/themes/preset/rngs/otherwise.rng +22 -0
- data/tools/test/themes/preset/rngs/parallel.rng +21 -0
- data/tools/test/themes/preset/rngs/parallel_branch.rng +8 -0
- data/tools/test/themes/preset/rngs/scripts.rng +23 -0
- data/tools/test/themes/preset/rngs/stop.rng +5 -0
- data/tools/test/themes/preset/rngs/terminate.rng +1 -0
- data/tools/test/themes/preset/symbols/alternative.svg +5 -0
- data/tools/test/themes/preset/symbols/arrow.svg +3 -0
- data/tools/test/themes/preset/symbols/call.svg +6 -0
- data/tools/test/themes/preset/symbols/callmanipulate.svg +8 -0
- data/tools/test/themes/preset/symbols/choose.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_exclusive.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_inclusive.svg +4 -0
- data/tools/test/themes/preset/symbols/closed_loop.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_cancel.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_control.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_measuring.svg +6 -0
- data/tools/test/themes/preset/symbols/complex.svg +8 -0
- data/tools/test/themes/preset/symbols/critical.svg +4 -0
- data/tools/test/themes/preset/symbols/end.svg +3 -0
- data/tools/test/themes/preset/symbols/escape.svg +5 -0
- data/tools/test/themes/preset/symbols/event_end.svg +3 -0
- data/tools/test/themes/preset/symbols/loop.svg +5 -0
- data/tools/test/themes/preset/symbols/manipulate.svg +4 -0
- data/tools/test/themes/preset/symbols/otherwise.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch_compact.svg +4 -0
- data/tools/test/themes/preset/symbols/parallel_branch_event.svg +14 -0
- data/tools/test/themes/preset/symbols/parallel_branch_normal.svg +5 -0
- data/tools/test/themes/preset/symbols/scripts.svg +4 -0
- data/tools/test/themes/preset/symbols/start.svg +3 -0
- data/tools/test/themes/preset/symbols/stop.svg +5 -0
- data/tools/test/themes/preset/symbols/terminate.svg +4 -0
- data/tools/test/themes/preset/theme.js +1287 -0
- data/tools/test/track.html +142 -0
- metadata +221 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c2b0fc3e70d0f49877aea179e123e807cadfa5af37040267519e5a0ff1ec1e4
|
|
4
|
+
data.tar.gz: 82f1906f306514d813d0a0f91945dd641152aaec603035eaeecec6955e46f343
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcffe281651210b16ef430eecdad77f92e0ac4406672bd555c8fb08e206e218eb496473cb1e1046eb0c643bceaf7cc6172b82a3fa65413f95eaab7ef5218f69e
|
|
7
|
+
data.tar.gz: 7b0aa6519e115d11727427446bcacdb2a6dab4400a62eb323527ce89f4310cdde342ef23f30ec95601c92bfccd22284cb20b34ee3916d07e96fdf85c5908f387
|
data/cockpit/css/wfadaptor.css
CHANGED
|
@@ -346,6 +346,23 @@ svg text.label {
|
|
|
346
346
|
font-family:Arial;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
svg text.smaller {
|
|
350
|
+
font-size:12px;
|
|
351
|
+
font-style:normal;
|
|
352
|
+
font-variant:normal;
|
|
353
|
+
font-weight:bold;
|
|
354
|
+
font-stretch:normal;
|
|
355
|
+
text-align:center;
|
|
356
|
+
line-height:125%;
|
|
357
|
+
writing-mode:horizontal-tb;
|
|
358
|
+
text-anchor:middle;
|
|
359
|
+
color: var(--wfadaptor-base);
|
|
360
|
+
fill: var(--wfadaptor-base);
|
|
361
|
+
fill-opacity:1;
|
|
362
|
+
stroke:none;
|
|
363
|
+
font-family:Arial;
|
|
364
|
+
}
|
|
365
|
+
|
|
349
366
|
#arrow {
|
|
350
367
|
stroke: var(--wfadaptor-base);
|
|
351
368
|
stroke-width: 2;
|
data/cockpit/js/instance.js
CHANGED
|
@@ -838,7 +838,6 @@ function get_testset(deferred) {// {{{
|
|
|
838
838
|
$('testset > dsl',testset).remove();
|
|
839
839
|
$('testset > dslx',testset).remove();
|
|
840
840
|
$('testset > attributes > uuid',testset).remove();
|
|
841
|
-
$('testset > attributes > theme',testset).remove();
|
|
842
841
|
testset.append($X('<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>'));
|
|
843
842
|
var name = $('testset > attributes > info',testset).text();
|
|
844
843
|
$('[xmlns]',testset).each((idx,ele) => {
|
data/cockpit/js_libs.zip
ADDED
|
Binary file
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
<value id="sensor">Read From Sensor</value>
|
|
9
9
|
<value id="human">Human Task</value>
|
|
10
10
|
<value id="subprocess">Subprocess</value>
|
|
11
|
-
<value id="robot">Robot</value>
|
|
11
|
+
<value id="robot">Robot Task</value>
|
|
12
|
+
<value id="robot_subprocess">Robot Subprocess</value>
|
|
12
13
|
<value id="plc">PLC</value>
|
|
13
14
|
<value id="send">Send Message</value>
|
|
14
15
|
<value id="receive">Receive Message</value>
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
<value id="sensor">Read From Sensor</value>
|
|
9
9
|
<value id="human">Human Task</value>
|
|
10
10
|
<value id="subprocess">Subprocess</value>
|
|
11
|
-
<value id="robot">Robot</value>
|
|
11
|
+
<value id="robot">Robot Task</value>
|
|
12
|
+
<value id="robot_subprocess">Robot Subprocess</value>
|
|
12
13
|
<value id="plc">PLC</value>
|
|
13
14
|
<value id="send">Send Message</value>
|
|
14
15
|
<value id="receive">Receive Message</value>
|
|
@@ -241,7 +241,7 @@ function WFAdaptorManifestation(adaptor) {
|
|
|
241
241
|
'label': function(node){
|
|
242
242
|
var ret;
|
|
243
243
|
if ($('> url',$(node).children('parameters').children('arguments')).length > 0) {
|
|
244
|
-
ret = [ { column: 'Label', value: $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') + ' <a target="
|
|
244
|
+
ret = [ { column: 'Label', value: $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') + ' <a target="_blank" href="' + $('> url',$(node).children('parameters').children('arguments')).text() + '"></a>' } ];
|
|
245
245
|
} else {
|
|
246
246
|
ret = [ { column: 'Label', value: $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') } ];
|
|
247
247
|
}
|
data/cpee.gemspec
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "cpee"
|
|
3
|
-
s.version = "2.0.
|
|
3
|
+
s.version = "2.0.20"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
5
|
s.license = "LGPL-3.0"
|
|
6
6
|
s.summary = "Preliminary release of cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
|
|
7
7
|
|
|
8
8
|
s.description = "see http://cpee.org"
|
|
9
9
|
|
|
10
|
-
s.files = Dir['{example/**/*,server/**/*,tools/**/*,tools/archive,lib/**/*,cockpit/**/*,cockpit/themes/*/*/*,contrib/logo*,contrib/Screen*}'] - Dir['{server/instances/**/*,cockpit/js_libs
|
|
10
|
+
s.files = Dir['{example/**/*,server/**/*,tools/**/*,tools/archive,lib/**/*,cockpit/**/*,cockpit/themes/*/*/*,contrib/logo*,contrib/Screen*}'] - Dir['{server/instances/**/*,cockpit/js_libs/**/*,server/redis*}'] + %w(COPYING FEATURES.md INSTALL.md Rakefile cpee.gemspec README.md AUTHORS)
|
|
11
11
|
s.require_path = 'lib'
|
|
12
12
|
s.extra_rdoc_files = ['README.md']
|
|
13
13
|
s.bindir = 'tools'
|
data/lib/cpee/controller.rb
CHANGED
|
@@ -20,6 +20,7 @@ require 'riddl/client'
|
|
|
20
20
|
require_relative 'value_helper'
|
|
21
21
|
require_relative 'attributes_helper'
|
|
22
22
|
require_relative 'message'
|
|
23
|
+
require_relative 'redis'
|
|
23
24
|
|
|
24
25
|
require 'ostruct'
|
|
25
26
|
class ParaStruct < OpenStruct
|
|
@@ -34,7 +35,9 @@ module CPEE
|
|
|
34
35
|
|
|
35
36
|
class Controller
|
|
36
37
|
def initialize(id,dir,opts)
|
|
37
|
-
|
|
38
|
+
CPEE::redis_connect(opts)
|
|
39
|
+
|
|
40
|
+
@redis = opts[:redis]
|
|
38
41
|
@votes = []
|
|
39
42
|
|
|
40
43
|
@id = id
|
|
@@ -134,7 +137,7 @@ module CPEE
|
|
|
134
137
|
|
|
135
138
|
if votes.length > 0
|
|
136
139
|
@votes += votes
|
|
137
|
-
psredis =
|
|
140
|
+
psredis = @opts[:redis_dyn].call
|
|
138
141
|
collect = []
|
|
139
142
|
psredis.subscribe(votes.map{|e| ['vote-response:' + e.to_s, 'vote-end:' + e.to_s] }.flatten) do |on|
|
|
140
143
|
on.message do |what, message|
|
|
@@ -158,7 +161,7 @@ module CPEE
|
|
|
158
161
|
def callback(hw,key,content)
|
|
159
162
|
CPEE::Message::send(:callback,'activity/content',base,@id,uuid,info,content.merge(:key => key),@redis)
|
|
160
163
|
|
|
161
|
-
psredis =
|
|
164
|
+
psredis = @opts[:redis_dyn].call
|
|
162
165
|
response = nil
|
|
163
166
|
Thread.new do
|
|
164
167
|
psredis.subscribe('callback-response:' + key, 'callback-end:' + key) do |on|
|
data/lib/cpee/implementation.rb
CHANGED
|
@@ -16,6 +16,7 @@ require 'fileutils'
|
|
|
16
16
|
require 'redis'
|
|
17
17
|
require 'riddl/server'
|
|
18
18
|
require 'riddl/client'
|
|
19
|
+
require_relative 'redis'
|
|
19
20
|
require_relative 'message'
|
|
20
21
|
require_relative 'persistence'
|
|
21
22
|
require_relative 'statemachine'
|
|
@@ -70,12 +71,22 @@ module CPEE
|
|
|
70
71
|
opts[:watchdog_start_off] ||= false
|
|
71
72
|
opts[:backend_instance] ||= 'instance.rb'
|
|
72
73
|
opts[:infinite_loop_stop] ||= 10000
|
|
73
|
-
opts[:redis_path] ||= '/tmp/redis.sock'
|
|
74
|
-
opts[:redis_db] ||= 3
|
|
75
|
-
opts[:sse_keepalive_frequency] ||= 10
|
|
76
74
|
|
|
75
|
+
### set redis_cmd to nil if you want to do global
|
|
76
|
+
### at least redis_path or redis_url and redis_db have to be set if you do global
|
|
77
|
+
opts[:redis_path] ||= 'redis.sock' # use e.g. /tmp/redis.sock for global stuff. Look it up in your redis config
|
|
78
|
+
opts[:redis_db] ||= 0
|
|
79
|
+
### optional redis stuff
|
|
80
|
+
opts[:redis_url] ||= nil
|
|
81
|
+
opts[:redis_cmd] ||= 'redis-server --port 0 --unixsocket #redis_path# --unixsocketperm 600 --pidfile #redis_pid# --dir #redis_db_dir# --dbfilename #redis_db_name# --databases 1 --save 900 1 --save 300 10 --save 60 10000 --rdbcompression yes --daemonize yes'
|
|
82
|
+
opts[:redis_pid] ||= 'redis.pid' # use e.g. /var/run/redis.pid if you do global. Look it up in your redis config
|
|
83
|
+
opts[:redis_db_name] ||= 'redis.rdb' # use e.g. /var/lib/redis.rdb for global stuff. Look it up in your redis config
|
|
84
|
+
|
|
85
|
+
CPEE::redis_connect opts
|
|
86
|
+
|
|
87
|
+
opts[:sse_keepalive_frequency] ||= 10
|
|
77
88
|
opts[:sse_connections] = {}
|
|
78
|
-
|
|
89
|
+
|
|
79
90
|
opts[:statemachine] = CPEE::StateMachine.new opts[:states], %w{running simulating replaying finishing stopping abandoned finished} do |id|
|
|
80
91
|
opts[:redis].get("instance:#{id}/state")
|
|
81
92
|
end
|
|
@@ -90,9 +101,9 @@ module CPEE
|
|
|
90
101
|
|
|
91
102
|
Proc.new do
|
|
92
103
|
parallel do
|
|
93
|
-
CPEE::watch_services(opts[:watchdog_start_off])
|
|
104
|
+
CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],File.join(opts[:basepath],opts[:redis_path]),opts[:redis_db])
|
|
94
105
|
EM.add_periodic_timer(opts[:watchdog_frequency]) do ### start services
|
|
95
|
-
CPEE::watch_services(opts[:watchdog_start_off])
|
|
106
|
+
CPEE::watch_services(opts[:watchdog_start_off],opts[:redis_url],File.join(opts[:basepath],opts[:redis_path]),opts[:redis_db])
|
|
96
107
|
end
|
|
97
108
|
EM.defer do ### catch all sse connections
|
|
98
109
|
CPEE::Notifications::sse_distributor(opts)
|
|
@@ -132,14 +143,18 @@ module CPEE
|
|
|
132
143
|
end
|
|
133
144
|
end
|
|
134
145
|
|
|
135
|
-
def self::watch_services(watchdog_start_off)
|
|
146
|
+
def self::watch_services(watchdog_start_off,url,path,db)
|
|
136
147
|
return if watchdog_start_off
|
|
137
148
|
EM.defer do
|
|
138
149
|
Dir[File.join(__dir__,'..','..','server','routing','*.rb')].each do |s|
|
|
139
150
|
s = s.sub(/\.rb$/,'')
|
|
140
151
|
pid = (File.read(s + '.pid').to_i rescue nil)
|
|
141
152
|
if (pid.nil? || !(Process.kill(0, pid) rescue false)) && !File.exist?(s + '.lock')
|
|
142
|
-
|
|
153
|
+
if url.nil?
|
|
154
|
+
system "#{s}.rb -p \"#{path}\" -d #{db} restart 1>/dev/null 2>&1"
|
|
155
|
+
else
|
|
156
|
+
system "#{s}.rb -u \"#{url}\" -d #{db} restart 1>/dev/null 2>&1"
|
|
157
|
+
end
|
|
143
158
|
puts "➡ Service #{File.basename(s,'.rb')} started ..."
|
|
144
159
|
end
|
|
145
160
|
end
|
|
@@ -165,7 +165,7 @@ module CPEE
|
|
|
165
165
|
end #}}}
|
|
166
166
|
|
|
167
167
|
def self::sse_distributor(opts) #{{{
|
|
168
|
-
conn =
|
|
168
|
+
conn = opts[:redis_dyn].call
|
|
169
169
|
conn.psubscribe('forward:*','event:state/change') do |on|
|
|
170
170
|
on.pmessage do |pat, what, message|
|
|
171
171
|
if pat == 'forward:*'
|
data/lib/cpee/persistence.rb
CHANGED
|
@@ -30,7 +30,8 @@ module CPEE
|
|
|
30
30
|
YAML::dump({
|
|
31
31
|
:host => opts[:host],
|
|
32
32
|
:url => opts[:url],
|
|
33
|
-
:
|
|
33
|
+
:redis_url => opts[:redis_url],
|
|
34
|
+
:redis_path => File.join(opts[:basepath],opts[:redis_path]),
|
|
34
35
|
:redis_db => opts[:redis_db],
|
|
35
36
|
:global_handlerwrappers => opts[:global_handlerwrappers],
|
|
36
37
|
:handlerwrappers => opts[:handlerwrappers]
|
data/lib/cpee/redis.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# This file is part of CPEE.
|
|
2
|
+
#
|
|
3
|
+
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
4
|
+
# of the GNU General Public License as published by the Free Software Foundation,
|
|
5
|
+
# either version 3 of the License, or (at your option) any later version.
|
|
6
|
+
#
|
|
7
|
+
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
8
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
+
#
|
|
11
|
+
# You should have received a copy of the GNU General Public License along with
|
|
12
|
+
# CPEE (file COPYING in the main directory). If not, see
|
|
13
|
+
# <http://www.gnu.org/licenses/>.
|
|
14
|
+
|
|
15
|
+
require 'redis'
|
|
16
|
+
|
|
17
|
+
module CPEE
|
|
18
|
+
def self::redis_connect(opts)
|
|
19
|
+
if opts[:redis_cmd].nil?
|
|
20
|
+
begin
|
|
21
|
+
if opts[:redis_path]
|
|
22
|
+
opts[:redis_dyn] = Proc.new { Redis.new(path: opts[:redis_path], db: opts[:redis_db]) }
|
|
23
|
+
elsif opts[:redis_url]
|
|
24
|
+
opts[:redis_dyn] = Proc.new { Redis.new(url: opts[:redis_url], db: opts[:redis_db]) }
|
|
25
|
+
else
|
|
26
|
+
raise
|
|
27
|
+
end
|
|
28
|
+
opts[:redis] = opts[:redis_dyn].call
|
|
29
|
+
opts[:redis].dbsize
|
|
30
|
+
rescue
|
|
31
|
+
puts 'can not connect to redis. check if it is running and cpee is configured correctly ...'
|
|
32
|
+
exit
|
|
33
|
+
end
|
|
34
|
+
else # we always assume file socket if redis is startet locally
|
|
35
|
+
opts[:redis_dyn] = Proc.new { Redis.new(path: File.join(opts[:basepath],opts[:redis_path]), db: opts[:redis_db].to_i) }
|
|
36
|
+
begin
|
|
37
|
+
opts[:redis] = opts[:redis_dyn].call
|
|
38
|
+
opts[:redis].dbsize
|
|
39
|
+
rescue
|
|
40
|
+
rcmd = opts[:redis_cmd]
|
|
41
|
+
rcmd.gsub! /#redis_path#/, File.join(opts[:basepath],opts[:redis_path])
|
|
42
|
+
rcmd.gsub! /#redis_db_dir#/, opts[:basepath]
|
|
43
|
+
rcmd.gsub! /#redis_db_name#/, opts[:redis_db_name]
|
|
44
|
+
rcmd.gsub! /#redis_pid#/, File.join(opts[:basepath],opts[:redis_pid])
|
|
45
|
+
res = system rcmd
|
|
46
|
+
if res
|
|
47
|
+
puts 'starting redis ... it will keep running, just to let you know ...'
|
|
48
|
+
sleep 1
|
|
49
|
+
retry
|
|
50
|
+
else
|
|
51
|
+
puts 'can not start redis. check if cpee is configured correctly ...'
|
|
52
|
+
exit
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/server/routing/end.rb
CHANGED
|
@@ -17,18 +17,30 @@
|
|
|
17
17
|
require 'json'
|
|
18
18
|
require 'redis'
|
|
19
19
|
require 'daemonite'
|
|
20
|
+
require_relative '../../lib/cpee/redis'
|
|
20
21
|
|
|
21
22
|
Daemonite.new do |opts|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
opts[:runtime_opts] += [
|
|
24
|
+
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
25
|
+
["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
|
|
26
|
+
["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
on startup do
|
|
30
|
+
opts[:redis_path] ||= '/tmp/redis.sock'
|
|
31
|
+
opts[:redis_db] ||= 1
|
|
32
|
+
|
|
33
|
+
CPEE::redis_connect opts
|
|
34
|
+
opts[:pubsubredis] = opts[:redis_dyn].call
|
|
35
|
+
end
|
|
24
36
|
|
|
25
37
|
run do
|
|
26
|
-
pubsubredis.psubscribe('callback-end:*') do |on|
|
|
38
|
+
opts[:pubsubredis].psubscribe('callback-end:*') do |on|
|
|
27
39
|
on.pmessage do |pat, what, message|
|
|
28
40
|
_, key = what.split(':')
|
|
29
41
|
index = message.index(' ')
|
|
30
42
|
instance = message[0...index]
|
|
31
|
-
redis.multi do |multi|
|
|
43
|
+
opts[:redis].multi do |multi|
|
|
32
44
|
multi.srem("instance:#{instance}/callbacks",key)
|
|
33
45
|
multi.del("instance:#{instance}/callback/#{key}/uuid")
|
|
34
46
|
multi.del("instance:#{instance}/callback/#{key}/label")
|
|
@@ -17,13 +17,25 @@
|
|
|
17
17
|
require 'redis'
|
|
18
18
|
require 'daemonite'
|
|
19
19
|
require 'riddl/client'
|
|
20
|
+
require_relative '../../lib/cpee/redis'
|
|
20
21
|
|
|
21
22
|
Daemonite.new do |opts|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
opts[:runtime_opts] += [
|
|
24
|
+
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
25
|
+
["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
|
|
26
|
+
["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
on startup do
|
|
30
|
+
opts[:redis_path] ||= '/tmp/redis.sock'
|
|
31
|
+
opts[:redis_db] ||= 1
|
|
32
|
+
|
|
33
|
+
CPEE::redis_connect opts
|
|
34
|
+
opts[:pubsubredis] = opts[:redis_dyn].call
|
|
35
|
+
end
|
|
24
36
|
|
|
25
37
|
run do
|
|
26
|
-
pubsubredis.psubscribe('event:*') do |on|
|
|
38
|
+
opts[:pubsubredis].psubscribe('event:*') do |on|
|
|
27
39
|
on.pmessage do |pat, what, message|
|
|
28
40
|
index = message.index(' ')
|
|
29
41
|
mess = message[index+1..-1]
|
|
@@ -33,11 +45,11 @@ Daemonite.new do |opts|
|
|
|
33
45
|
topic = ::File::dirname(event)
|
|
34
46
|
name = ::File::basename(event)
|
|
35
47
|
long = File.join(topic,type,name)
|
|
36
|
-
redis.smembers("instance:#{instance}/handlers").each do |key|
|
|
37
|
-
if redis.smembers("instance:#{instance}/handlers/#{key}").include? long
|
|
38
|
-
url = redis.get("instance:#{instance}/handlers/#{key}/url")
|
|
48
|
+
opts[:redis].smembers("instance:#{instance}/handlers").each do |key|
|
|
49
|
+
if opts[:redis].smembers("instance:#{instance}/handlers/#{key}").include? long
|
|
50
|
+
url = opts[:redis].get("instance:#{instance}/handlers/#{key}/url")
|
|
39
51
|
if url.nil? || url == ""
|
|
40
|
-
redis.publish("forward:#{instance}/#{key}",mess)
|
|
52
|
+
opts[:redis].publish("forward:#{instance}/#{key}",mess)
|
|
41
53
|
else
|
|
42
54
|
p "#{type}/#{topic}/#{event}-#{url}"
|
|
43
55
|
client = Riddl::Client.new(url)
|
|
@@ -19,6 +19,7 @@ require 'daemonite'
|
|
|
19
19
|
require 'riddl/client'
|
|
20
20
|
require 'json'
|
|
21
21
|
require_relative '../../lib/cpee/message'
|
|
22
|
+
require_relative '../../lib/cpee/redis'
|
|
22
23
|
|
|
23
24
|
def persist_handler(instance,key,mess,redis) #{{{
|
|
24
25
|
redis.multi do |multi|
|
|
@@ -44,11 +45,22 @@ def send_response(instance,key,url,value,redis) #{{{
|
|
|
44
45
|
end #}}}
|
|
45
46
|
|
|
46
47
|
Daemonite.new do |opts|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
opts[:runtime_opts] += [
|
|
49
|
+
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
50
|
+
["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
|
|
51
|
+
["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
on startup do
|
|
55
|
+
opts[:redis_path] ||= '/tmp/redis.sock'
|
|
56
|
+
opts[:redis_db] ||= 1
|
|
57
|
+
|
|
58
|
+
CPEE::redis_connect opts
|
|
59
|
+
opts[:pubsubredis] = opts[:redis_dyn].call
|
|
60
|
+
end
|
|
49
61
|
|
|
50
62
|
run do
|
|
51
|
-
pubsubredis.psubscribe('vote:*') do |on|
|
|
63
|
+
opts[:pubsubredis].psubscribe('vote:*') do |on|
|
|
52
64
|
on.pmessage do |pat, what, message|
|
|
53
65
|
index = message.index(' ')
|
|
54
66
|
mess = message[index+1..-1]
|
|
@@ -60,15 +72,15 @@ Daemonite.new do |opts|
|
|
|
60
72
|
name = ::File::basename(event)
|
|
61
73
|
long = File.join(topic,type,name)
|
|
62
74
|
|
|
63
|
-
redis.smembers("instance:#{instance}/handlers").each do |subscription_key|
|
|
64
|
-
if redis.smembers("instance:#{instance}/handlers/#{subscription_key}").include? long
|
|
75
|
+
opts[:redis].smembers("instance:#{instance}/handlers").each do |subscription_key|
|
|
76
|
+
if opts[:redis].smembers("instance:#{instance}/handlers/#{subscription_key}").include? long
|
|
65
77
|
m = JSON.parse(mess)
|
|
66
78
|
callback_key = m.dig('content','key')
|
|
67
|
-
url = redis.get("instance:#{instance}/handlers/#{subscription_key}/url")
|
|
79
|
+
url = opts[:redis].get("instance:#{instance}/handlers/#{subscription_key}/url")
|
|
68
80
|
|
|
69
81
|
if url.nil? || url == ""
|
|
70
82
|
persist_handler instance, callback_key, m, redis
|
|
71
|
-
redis.publish("forward:#{instance}/#{subscription_key}",mess)
|
|
83
|
+
opts[:redis].publish("forward:#{instance}/#{subscription_key}",mess)
|
|
72
84
|
else
|
|
73
85
|
client = Riddl::Client.new(url)
|
|
74
86
|
callback = m['instance-url'] + '/callbacks/' + subscription_key
|
data/server/routing/persist.rb
CHANGED
|
@@ -18,6 +18,7 @@ require 'json'
|
|
|
18
18
|
require 'redis'
|
|
19
19
|
require 'daemonite'
|
|
20
20
|
require_relative '../../lib/cpee/value_helper'
|
|
21
|
+
require_relative '../../lib/cpee/redis'
|
|
21
22
|
|
|
22
23
|
EVENTS = %w{
|
|
23
24
|
event:state/change
|
|
@@ -34,18 +35,29 @@ EVENTS = %w{
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
Daemonite.new do |opts|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
opts[:runtime_opts] += [
|
|
39
|
+
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
40
|
+
["--path=PATH", "-pPATH", "Specify redis path, e.g. /tmp/redis.sock", ->(p){ opts[:redis_path] = p }],
|
|
41
|
+
["--db=DB", "-dDB", "Specify redis db, e.g. 1", ->(p) { opts[:redis_db] = p.to_i }]
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
on startup do
|
|
45
|
+
opts[:redis_path] ||= '/tmp/redis.sock'
|
|
46
|
+
opts[:redis_db] ||= 1
|
|
47
|
+
|
|
48
|
+
CPEE::redis_connect opts
|
|
49
|
+
opts[:pubsubredis] = opts[:redis_dyn].call
|
|
50
|
+
end
|
|
39
51
|
|
|
40
52
|
run do
|
|
41
|
-
pubsubredis.subscribe(EVENTS) do |on|
|
|
53
|
+
opts[:pubsubredis].subscribe(EVENTS) do |on|
|
|
42
54
|
on.message do |what, message|
|
|
43
55
|
mess = JSON.parse(message[message.index(' ')+1..-1])
|
|
44
56
|
instance = mess.dig('instance')
|
|
45
57
|
case what
|
|
46
58
|
when 'callback:activity/content'
|
|
47
59
|
key = mess.dig('content','key')
|
|
48
|
-
redis.multi do |multi|
|
|
60
|
+
opts[:redis].multi do |multi|
|
|
49
61
|
multi.sadd("instance:#{instance}/callbacks",key)
|
|
50
62
|
multi.set("instance:#{instance}/callback/#{key}/uuid",mess.dig('content','activity_uuid'))
|
|
51
63
|
multi.set("instance:#{instance}/callback/#{key}/label",mess.dig('content','label'))
|
|
@@ -53,21 +65,21 @@ Daemonite.new do |opts|
|
|
|
53
65
|
multi.set("instance:#{instance}/callback/#{key}/type",'callback')
|
|
54
66
|
end
|
|
55
67
|
when 'event:state/change'
|
|
56
|
-
redis.multi do |multi|
|
|
68
|
+
opts[:redis].multi do |multi|
|
|
57
69
|
multi.set("instance:#{instance}/state",mess.dig('content','state'))
|
|
58
70
|
multi.set("instance:#{instance}/state/@changed",mess.dig('timestamp'))
|
|
59
71
|
end
|
|
60
72
|
when 'event:handlerwrapper/change'
|
|
61
|
-
redis.set("instance:#{instance}/handlerwrapper",mess.dig('content','handlerwrapper'))
|
|
73
|
+
opts[:redis].set("instance:#{instance}/handlerwrapper",mess.dig('content','handlerwrapper'))
|
|
62
74
|
when 'event:description/change'
|
|
63
|
-
redis.multi do |multi|
|
|
75
|
+
opts[:redis].multi do |multi|
|
|
64
76
|
multi.set("instance:#{instance}/description",mess.dig('content','description'))
|
|
65
77
|
multi.set("instance:#{instance}/dslx",mess.dig('content','dslx'))
|
|
66
78
|
multi.set("instance:#{instance}/dsl",mess.dig('content','dsl'))
|
|
67
79
|
end
|
|
68
80
|
when 'event:dataelements/change', 'event:endpoints/change', 'event:attributes/change'
|
|
69
81
|
topic = mess.dig('topic')
|
|
70
|
-
redis.multi do |multi|
|
|
82
|
+
opts[:redis].multi do |multi|
|
|
71
83
|
mess.dig('content','changed')&.each_with_index do |c,i|
|
|
72
84
|
unless what == 'event:attributes/change' && c == 'uuid'
|
|
73
85
|
multi.zadd("instance:#{instance}/#{topic}",i,c)
|
|
@@ -86,7 +98,7 @@ Daemonite.new do |opts|
|
|
|
86
98
|
end
|
|
87
99
|
end
|
|
88
100
|
when 'event:transformation/change'
|
|
89
|
-
redis.multi do |multi|
|
|
101
|
+
opts[:redis].multi do |multi|
|
|
90
102
|
multi.set("instance:#{instance}/transformation/description/",mess.dig('content','description'))
|
|
91
103
|
multi.set("instance:#{instance}/transformation/description/@type",mess.dig('content','description_type'))
|
|
92
104
|
multi.set("instance:#{instance}/transformation/dataelements/",mess.dig('content','dataelements'))
|
|
@@ -95,12 +107,12 @@ Daemonite.new do |opts|
|
|
|
95
107
|
multi.set("instance:#{instance}/transformation/endpoints/@type",mess.dig('content','endpoints_type'))
|
|
96
108
|
end
|
|
97
109
|
when 'event:status/change'
|
|
98
|
-
redis.multi do |multi|
|
|
110
|
+
opts[:redis].multi do |multi|
|
|
99
111
|
multi.set("instance:#{instance}/status/id",mess.dig('content','id'))
|
|
100
112
|
multi.set("instance:#{instance}/status/message",mess.dig('content','message'))
|
|
101
113
|
end
|
|
102
114
|
when 'event:position/change'
|
|
103
|
-
redis.multi do |multi|
|
|
115
|
+
opts[:redis].multi do |multi|
|
|
104
116
|
c = mess.dig('content')
|
|
105
117
|
c.dig('unmark')&.each do |ele|
|
|
106
118
|
multi.srem("instance:#{instance}/positions",ele['position'])
|
|
@@ -127,7 +139,7 @@ Daemonite.new do |opts|
|
|
|
127
139
|
end
|
|
128
140
|
end
|
|
129
141
|
when 'event:handler/change'
|
|
130
|
-
redis.multi do |multi|
|
|
142
|
+
opts[:redis].multi do |multi|
|
|
131
143
|
mess.dig('content','changed').each do |c|
|
|
132
144
|
multi.sadd("instance:#{instance}/handlers",mess.dig('content','key'))
|
|
133
145
|
multi.sadd("instance:#{instance}/handlers/#{mess.dig('content','key')}",c)
|
|
@@ -139,8 +151,8 @@ Daemonite.new do |opts|
|
|
|
139
151
|
multi.srem("instance:#{instance}/handlers/#{c}",mess.dig('content','key'))
|
|
140
152
|
end
|
|
141
153
|
end
|
|
142
|
-
if redis.scard("instance:#{instance}/handlers/#{mess.dig('content','key')}") < 1
|
|
143
|
-
redis.multi do |multi|
|
|
154
|
+
if opts[:redis].scard("instance:#{instance}/handlers/#{mess.dig('content','key')}") < 1
|
|
155
|
+
opts[:redis].multi do |multi|
|
|
144
156
|
multi.del("instance:#{instance}/handlers/#{mess.dig('content','key')}/url")
|
|
145
157
|
multi.srem("instance:#{instance}/handlers",mess.dig('content','key'))
|
|
146
158
|
end
|