redpack 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ class Client
56
56
  if sync || async
57
57
  method_name.gsub!(/_sync$/, '') if sync
58
58
  method_name.gsub!(/_async$/, '') if async
59
- future = send_request(method_name, args)
59
+ future = send_request(method_name, args, !!sync)
60
60
  future.attach_callback(block) if block
61
61
  if sync
62
62
  @transport.listen_for_return_sync
@@ -124,12 +124,12 @@ class Client
124
124
 
125
125
 
126
126
  private
127
- def send_request(method, param)
127
+ def send_request(method, param, sync = false)
128
128
  method = method.to_s
129
129
  msgid = @seqid
130
130
  @seqid += 1; if @seqid >= 1<<31 then @seqid = 0 end
131
131
  data = [REQUEST, msgid, method, param]
132
- @transport.send_data(data, msgid)
132
+ @transport.send_data(data, msgid, sync)
133
133
  @reqtable[msgid] = Future.new(self)
134
134
  end
135
135
 
File without changes
@@ -108,11 +108,11 @@ class RedisClientTransport
108
108
  end
109
109
  end
110
110
 
111
- def send_data(data, msgid = nil)
112
- if @ignore_return_value
111
+ def send_data(data, msgid = nil, sync = false)
112
+ if sync
113
+ redis_push(BSON.serialize({:data => data, :return => @return_queue_name}), msgid)
114
+ elsif @ignore_return_value || !sync
113
115
  redis_push(BSON.serialize({:data => data}), msgid)
114
- else
115
- redis_push(BSON.serialize({:data => data, :return => @return_queue_name}), msgid)
116
116
  end
117
117
  end
118
118
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 2
9
- version: 1.0.2
8
+ - 3
9
+ version: 1.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dean Mao
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-14 00:00:00 -08:00
17
+ date: 2011-01-19 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -62,6 +62,7 @@ files:
62
62
  - rblib/redpack/exception.rb
63
63
  - rblib/redpack/future.rb
64
64
  - rblib/redpack/message.rb
65
+ - rblib/redpack/rails.rb
65
66
  - rblib/redpack/server.rb
66
67
  - rblib/redpack/transport.rb
67
68
  - rblib/redpack.rb