freddy 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/freddy.gemspec +1 -2
- data/lib/freddy.rb +0 -1
- data/lib/freddy/request_manager.rb +11 -3
- data/spec/integration/concurrency_spec.rb +2 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f97109147edff0d5b3632c66652601b61c6c476
|
4
|
+
data.tar.gz: f2d777e287b18015d886646957f622310feb2042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 699e54d1b6a0fbde8c0bdde435b0177984ff3b0a80ad9f1d5698a98ef75ba32798475fda4cf16cdeb38e9ff7abebaac33347f2226ef1285dc7fe99dac09438ed
|
7
|
+
data.tar.gz: 8179925e34bd321be85ba9219513f7279c57b525efcea941beb5584fe6bfda0af4aa4ed149f427645969ee3f51c4babaff497152fe01c4f23783c041de13e01f
|
data/Gemfile
CHANGED
data/freddy.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
else
|
9
9
|
spec.name = "freddy"
|
10
10
|
end
|
11
|
-
spec.version = '0.6.
|
11
|
+
spec.version = '0.6.3'
|
12
12
|
spec.authors = ["Urmas Talimaa"]
|
13
13
|
spec.email = ["urmas.talimaa@gmail.com"]
|
14
14
|
spec.description = %q{Messaging API}
|
@@ -31,6 +31,5 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "oj", "~> 2.13"
|
32
32
|
end
|
33
33
|
|
34
|
-
spec.add_dependency "hamster", "~> 1.0.1.pre.rc3"
|
35
34
|
spec.add_dependency "thread", "~> 0.1"
|
36
35
|
end
|
data/lib/freddy.rb
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
class Freddy
|
2
2
|
class RequestManager
|
3
3
|
def initialize(logger)
|
4
|
-
@requests =
|
4
|
+
@requests = ConcurrentHash.new
|
5
5
|
@logger = logger
|
6
6
|
end
|
7
7
|
|
8
8
|
def no_route(correlation_id)
|
9
9
|
if request = @requests[correlation_id]
|
10
|
-
|
10
|
+
delete(correlation_id)
|
11
11
|
request[:callback].call({error: 'Specified queue does not exist'}, nil)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def store(correlation_id, opts)
|
16
|
-
@requests
|
16
|
+
@requests[correlation_id] = opts
|
17
17
|
end
|
18
18
|
|
19
19
|
def delete(correlation_id)
|
20
20
|
@requests.delete(correlation_id)
|
21
21
|
end
|
22
|
+
|
23
|
+
class ConcurrentHash < Hash
|
24
|
+
# CRuby hash does not need any locks. Only adding when using JRuby.
|
25
|
+
if RUBY_PLATFORM == 'java'
|
26
|
+
require 'jruby/synchronized'
|
27
|
+
include JRuby::Synchronized
|
28
|
+
end
|
29
|
+
end
|
22
30
|
end
|
23
31
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'hamster/experimental/mutable_set'
|
2
3
|
|
3
4
|
describe 'Concurrency' do
|
4
5
|
let(:freddy1) { Freddy.build(logger, config) }
|
@@ -88,7 +89,7 @@ describe 'Concurrency' do
|
|
88
89
|
context 'concurrent executions of deliver_with_response' do
|
89
90
|
let(:nr_of_threads) { 50 }
|
90
91
|
let(:payload) { {pay: 'load'} }
|
91
|
-
let(:msg_counter) { Hamster
|
92
|
+
let(:msg_counter) { Hamster::MutableSet[] }
|
92
93
|
let(:queue_name) { random_destination }
|
93
94
|
|
94
95
|
before do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urmas Talimaa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.13'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: hamster
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.1.pre.rc3
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.1.pre.rc3
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: thread
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|