alacrity-rails 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alacrity-rails.rb +5 -4
- data/lib/alacrity-rails/client.rb +19 -2
- data/lib/alacrity-rails/railtie.rb +1 -0
- data/lib/alacrity-rails/transaction/bulk_web_transaction.rb +17 -0
- data/lib/alacrity-rails/transaction/web_transaction.rb +2 -1
- data/lib/alacrity-rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4a31f3e6df15a1a21699624e93401efa2558982
|
4
|
+
data.tar.gz: accd16378db208150a6877e887e65809d4b5e1fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c26325730dee3b9f34bb75501472377cf2807aca50be22f6e8b6af0e6a3ae08b8cdc8f54d634125492d0b8c175a6e8c9679ea34bf0281dde7d1fba31417b6f6c
|
7
|
+
data.tar.gz: 66b0db61e130bbc1b9467fa2d77b2fe39e52db07fa3a86ad7ce87af8903f70439d09fef971f8cd17b8b7d161aaf2f669bc1ca0a8c0c2783236c6fbf8a9b094a7
|
data/lib/alacrity-rails.rb
CHANGED
@@ -20,10 +20,11 @@ module AlacrityRails
|
|
20
20
|
end
|
21
21
|
|
22
22
|
module Transaction
|
23
|
-
autoload :Base,
|
24
|
-
autoload :
|
25
|
-
autoload :
|
26
|
-
autoload :
|
23
|
+
autoload :Base, 'alacrity-rails/transaction/base'
|
24
|
+
autoload :BulkWebTransaction, 'alacrity-rails/transaction/bulk_web_transaction'
|
25
|
+
autoload :ConnectionTest, 'alacrity-rails/transaction/connection_test'
|
26
|
+
autoload :ServerStartup, 'alacrity-rails/transaction/server_startup'
|
27
|
+
autoload :WebTransaction, 'alacrity-rails/transaction/web_transaction'
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -16,8 +16,7 @@ module AlacrityRails
|
|
16
16
|
def self.close_transaction!(response)
|
17
17
|
if transaction
|
18
18
|
transaction.status = response.first
|
19
|
-
|
20
|
-
Thread.new { transmit(this_transaction) }
|
19
|
+
transmission_queue.push(transaction)
|
21
20
|
end
|
22
21
|
ensure
|
23
22
|
cleanup
|
@@ -43,6 +42,24 @@ module AlacrityRails
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
45
|
+
def self.transmission_queue
|
46
|
+
@transmission_queue ||= []
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.start_transmission_worker
|
50
|
+
Thread.new do
|
51
|
+
loop do
|
52
|
+
sleep 1
|
53
|
+
|
54
|
+
if transmission_queue.any?
|
55
|
+
transmit(AlacrityRails::Transaction::BulkWebTransaction.new(
|
56
|
+
transmission_queue.shift(transmission_queue.length)
|
57
|
+
))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
46
63
|
private
|
47
64
|
|
48
65
|
def self.new_transaction!(env)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AlacrityRails::Transaction
|
2
|
+
class BulkWebTransaction < Base
|
3
|
+
attr_accessor :web_transactions
|
4
|
+
|
5
|
+
def initialize(web_transactions)
|
6
|
+
self.web_transactions = web_transactions
|
7
|
+
end
|
8
|
+
|
9
|
+
def as_json(*args)
|
10
|
+
web_transactions.as_json
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.endpoint
|
14
|
+
@endpoint ||= URI("#{AlacrityRails::Config.collector_host}/v1/web-transactions")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alacrity-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alacrity, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/alacrity-rails/railtie.rb
|
48
48
|
- lib/alacrity-rails/server_config.rb
|
49
49
|
- lib/alacrity-rails/transaction/base.rb
|
50
|
+
- lib/alacrity-rails/transaction/bulk_web_transaction.rb
|
50
51
|
- lib/alacrity-rails/transaction/connection_test.rb
|
51
52
|
- lib/alacrity-rails/transaction/server_startup.rb
|
52
53
|
- lib/alacrity-rails/transaction/web_transaction.rb
|