raes 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/jobs/raes/stateless_job.rb +17 -0
- data/app/jobs/raes/subscribe_job.rb +4 -1
- data/config/routes.rb +1 -0
- data/lib/raes.rb +5 -1
- data/lib/raes/reducer.rb +4 -3
- data/lib/raes/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dffe3c6d3ae48ba6766d5805ae068d9bbb4a10a0f6134b8088c780d87cdafe6
|
4
|
+
data.tar.gz: aff12b845de5928976f25775531951d3ddc1bca1d925f6e1b056535d599fd31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2253c2b756dd88e3dcb49b48d3ee04e07e1e554b8d8dd2828bfedfd71d5a56264531770d3f7b829f41ede39d3f7d5c127aed3e5e735ebcb73b2fbc88485f63
|
7
|
+
data.tar.gz: 42ff96ce8da20cec8252bdf74a9363bb960338f0a5bc494d9df3515ad2eb77f6a4652b5a0a5ea52a60c1314e4d2b92b71f43a827ce2a55e867079865a409dfac
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Raes
|
4
|
+
class StatelessJob < ApplicationJob
|
5
|
+
def perform(name, payload)
|
6
|
+
ActiveRecord::Base.uncached do
|
7
|
+
klass = name.constantize
|
8
|
+
if klass.instance_method(:initialize).arity.zero?
|
9
|
+
klass.call
|
10
|
+
else
|
11
|
+
klass.call(payload.symbolize_keys)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
GC.start
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/raes.rb
CHANGED
@@ -10,7 +10,7 @@ require 'raes/reducer'
|
|
10
10
|
module Raes
|
11
11
|
def self.config
|
12
12
|
@config ||= Rails.application.config_for(:raes)
|
13
|
-
rescue StandardError
|
13
|
+
rescue StandardError
|
14
14
|
@config = {}
|
15
15
|
end
|
16
16
|
|
@@ -21,4 +21,8 @@ module Raes
|
|
21
21
|
def self.search(name)
|
22
22
|
Action.search(name)
|
23
23
|
end
|
24
|
+
|
25
|
+
def self.stateless(name, payload = {})
|
26
|
+
StatelessJob.perform_later(name.to_s, payload)
|
27
|
+
end
|
24
28
|
end
|
data/lib/raes/reducer.rb
CHANGED
@@ -23,10 +23,11 @@ module Raes
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_state
|
26
|
-
|
27
|
-
|
26
|
+
klass = @action.name.constantize
|
27
|
+
if klass.instance_method(:initialize).arity.zero?
|
28
|
+
klass.call
|
28
29
|
else
|
29
|
-
|
30
|
+
klass.call(JSON.parse(@action.payload).symbolize_keys)
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/raes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ogom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- app/controllers/raes/application_controller.rb
|
88
88
|
- app/helpers/raes/application_helper.rb
|
89
89
|
- app/jobs/raes/application_job.rb
|
90
|
+
- app/jobs/raes/stateless_job.rb
|
90
91
|
- app/jobs/raes/subscribe_job.rb
|
91
92
|
- app/mailers/raes/application_mailer.rb
|
92
93
|
- app/models/raes/action.rb
|