ld-celluloid-eventsource 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f33aac634f96a65252e98eaca774d9f5df2a12e6
4
- data.tar.gz: 77f105c227ead24d0d477345f1a30bb0093eb661
3
+ metadata.gz: 436ffbb975c4f324a9f3589984e6bc9344884319
4
+ data.tar.gz: 4396b0535c22dadff98bc1760642318157630451
5
5
  SHA512:
6
- metadata.gz: dd143c0275f774054aaf7a1246f87ca462fd03202d011984f57735c8f7480eb1aa3aee77a40816e0acd1fc1c0e8adac9d18162eb9e27ececcad74651724393c8
7
- data.tar.gz: 2896213a7d5a0155df43ca9aab8b097d4a45bdae971c45fc4befaa92113929791dd5e1e4da90557e9518a4310a9a702bf464bea6c169b240f82e45bf8693857a
6
+ metadata.gz: 22c0dc786d05848a98ec0633c9c866a0d1375c33314c6b55664fac478e88f1c49bf8de53d5611f8ec17a0477b4f60aa2216b98b8085859ca0b48be547b5855d2
7
+ data.tar.gz: b1de7d025ded3b794ad2a866dce4362b82b631708b0ddfa06c27ea48950973fdb02ab7fc4d64f2928cda4941f8e800a56ede50f54963c315893b6a63d073c372
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  class EventSource
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ module Celluloid
30
30
 
31
31
  @last_event_id = String.new
32
32
 
33
- @reconnect_timeout = 10
33
+ @reconnect_timeout = 1
34
34
  @on = { open: ->{}, message: ->(_) {}, error: ->(_) {} }
35
35
  @parser = ResponseParser.new
36
36
 
@@ -54,11 +54,15 @@ module Celluloid
54
54
  end
55
55
 
56
56
  def listen
57
- establish_connection
58
-
59
- chunked? ? process_chunked_stream : process_stream
60
- rescue
61
- after(1){ listen }
57
+ while !closed?
58
+ begin
59
+ establish_connection
60
+ chunked? ? process_chunked_stream : process_stream
61
+ rescue
62
+ # Just reconnect
63
+ end
64
+ sleep @reconnect_timeout
65
+ end
62
66
  end
63
67
 
64
68
  def close
@@ -108,7 +112,9 @@ module Celluloid
108
112
  until @socket.eof?
109
113
  @parser << @socket.readline
110
114
  end
111
- close
115
+ # If the server returns a non-200, we don't want to close-- we just want to
116
+ # report an error
117
+ # close
112
118
  @on[:error].call({status_code: @parser.status_code, body: @parser.chunk})
113
119
  return
114
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ld-celluloid-eventsource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Correa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-io