simultaneous 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/simultaneous.rb CHANGED
@@ -4,7 +4,7 @@ require 'socket'
4
4
  require 'eventmachine'
5
5
 
6
6
  module Simultaneous
7
- VERSION = "0.4.0"
7
+ VERSION = "0.4.1"
8
8
 
9
9
  DEFAULT_CONNECTION = "/tmp/simultaneous-server.sock"
10
10
  DEFAULT_PORT = 9999
@@ -23,25 +23,37 @@ module Simultaneous
23
23
  def client=(client); @client = client end
24
24
  def client; @client end
25
25
 
26
- def connection_completed
27
- # $stdout.puts "Client connection completed\\n"
28
- end
26
+ def connection_completed; end
29
27
 
30
28
  def receive_line(line)
31
29
  client.receive(line)
32
30
  end
33
31
 
34
- # def unbind
35
- # $stdout.puts "Client Connection closed\\\\\\\\n"
36
- # client.reconnect!
37
- # end
32
+ def unbind
33
+ $stderr.puts "#{Time.now} Client Connection closed\n"
34
+ client.reconnect!
35
+ end
38
36
  end
39
37
  handler
40
38
  end
41
39
 
42
40
  def reconnect!
41
+ attempt_reconnect
42
+ end
43
+
44
+ def attempt_reconnect
43
45
  @socket = nil
44
- connect
46
+ @reconnect_timer = EM::PeriodicTimer.new(1) do
47
+ $stderr.puts "#{Time.now} Attempting reconnect"
48
+ begin
49
+ connect
50
+ EM.cancel_timer(@reconnect_timer)
51
+ @reconnect_timer = nil
52
+ $stderr.puts "#{Time.now} Re-connection successful"
53
+ rescue => e
54
+ $stderr.puts "#{Time.now} Reconnection failed `#{e}`"
55
+ end
56
+ end
45
57
  end
46
58
 
47
59
  def close
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'rack/async'
3
+ #require 'rack/async'
4
4
 
5
5
  module Simultaneous
6
6
  module Rack
@@ -49,7 +49,7 @@ module Simultaneous
49
49
  end
50
50
 
51
51
  def app
52
- ::Rack::Async.new(self)
52
+ #::Rack::Async.new(self)
53
53
  end
54
54
 
55
55
  def call(env)
@@ -10,7 +10,7 @@ module Simultaneous
10
10
  end
11
11
 
12
12
  def self.included(klass)
13
- Simultaneous.client = Simultaneous::TaskClient.new
13
+ Simultaneous.client = Simultaneous::SyncClient.new
14
14
  Simultaneous.set_pid(self.task_name, pid) if task_name
15
15
  at_exit {
16
16
  begin
data/simultaneous.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'simultaneous'
16
- s.version = '0.4.0'
17
- s.date = '2012-02-23'
16
+ s.version = '0.4.1'
17
+ s.date = '2012-06-21'
18
18
  s.rubyforge_project = 'simultaneous'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -43,9 +43,9 @@ Gem::Specification.new do |s|
43
43
 
44
44
  ## List your runtime dependencies here. Runtime dependencies are those
45
45
  ## that are needed for an end user to actually USE your code.
46
- s.add_dependency('eventmachine', [">= 1.0.0.beta.4", "< 2.0"])
46
+ s.add_dependency('eventmachine', [">= 1.0.0.rc.1", "< 2.0"])
47
47
  s.add_dependency('rack', [">= 1.0", "< 2.0"])
48
- s.add_dependency('rack-async', [">= 0.0.1", "< 2.0"])
48
+ s.add_dependency('async-rack', ["~> 0.5.0"])
49
49
 
50
50
  ## List your development dependencies here. Development dependencies are
51
51
  ## those that are only needed during development
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simultaneous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,25 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-23 00:00:00.000000000 Z
12
+ date: 2012-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &70178587096280 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0.beta.4
21
+ version: 1.0.0.rc.1
22
22
  - - <
23
23
  - !ruby/object:Gem::Version
24
24
  version: '2.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70178587096280
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0.rc.1
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ version: '2.0'
28
36
  - !ruby/object:Gem::Dependency
29
37
  name: rack
30
- requirement: &70178587092600 !ruby/object:Gem::Requirement
38
+ requirement: !ruby/object:Gem::Requirement
31
39
  none: false
32
40
  requirements:
33
41
  - - ! '>='
@@ -38,24 +46,34 @@ dependencies:
38
46
  version: '2.0'
39
47
  type: :runtime
40
48
  prerelease: false
41
- version_requirements: *70178587092600
42
- - !ruby/object:Gem::Dependency
43
- name: rack-async
44
- requirement: &70178587106180 !ruby/object:Gem::Requirement
49
+ version_requirements: !ruby/object:Gem::Requirement
45
50
  none: false
46
51
  requirements:
47
52
  - - ! '>='
48
53
  - !ruby/object:Gem::Version
49
- version: 0.0.1
54
+ version: '1.0'
50
55
  - - <
51
56
  - !ruby/object:Gem::Version
52
57
  version: '2.0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: async-rack
60
+ requirement: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.5.0
53
66
  type: :runtime
54
67
  prerelease: false
55
- version_requirements: *70178587106180
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: 0.5.0
56
74
  - !ruby/object:Gem::Dependency
57
75
  name: rr
58
- requirement: &70178587104560 !ruby/object:Gem::Requirement
76
+ requirement: !ruby/object:Gem::Requirement
59
77
  none: false
60
78
  requirements:
61
79
  - - ~>
@@ -63,7 +81,12 @@ dependencies:
63
81
  version: 1.0.4
64
82
  type: :development
65
83
  prerelease: false
66
- version_requirements: *70178587104560
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.0.4
67
90
  description: Simultaneous is designed for the very specific use case of a small set
68
91
  of users collaborating on editing a single website. Because of that it is optimised
69
92
  for infrequent invocation of very long running publishing tasks and provides an
@@ -131,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
154
  version: '0'
132
155
  requirements: []
133
156
  rubyforge_project: simultaneous
134
- rubygems_version: 1.8.16
157
+ rubygems_version: 1.8.21
135
158
  signing_key:
136
159
  specification_version: 2
137
160
  summary: Simultaneous is the background task launcher used by Spontaneous CMS