onebody-updateagent 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/lib/updateagent/updateagent.rb +18 -11
  4. metadata +32 -24
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f882b057fa7b6a9b26e58f52e4d1daf9d2bf2f08
4
+ data.tar.gz: 47dfca0fd1b69709334dbc69a008434dc4de2b85
5
+ SHA512:
6
+ metadata.gz: 7e17fa87e0aad25a61d349eacfc32084269f64c00a8435df4134c47f05d2a05af60d2df2a0923236b7b03057adefc78d6f319d6b4005815475472b97b6477049
7
+ data.tar.gz: 0faff4c42a61b7ed3ecac915c7ae063a1a1e1dd383533e061921745f2a8fdd30191eca76600cb8f1fa074f0e00e01c23a7a37d31bad4575152fcf91a79bb97a7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
@@ -4,9 +4,12 @@ class UpdateAgent
4
4
  MAX_HASHES_AT_A_TIME = 500
5
5
  MAX_TO_BATCH_AT_A_TIME = 10
6
6
  SLEEP_PERIOD = 3
7
+ RETRIES = 5
8
+ RETRY_SLEEP = 15
7
9
 
8
10
  def initialize(data=nil, options={})
9
11
  @options = options
12
+ @options['debug'] = true
10
13
  @attributes = []
11
14
  @data = []
12
15
  @create = []
@@ -127,22 +130,26 @@ class UpdateAgent
127
130
  @errors = []
128
131
  puts 'Updating remote end...'
129
132
  index = 0
130
- retries = 10
131
133
  print "#{resource.name} 0/0\r"; STDOUT.flush
132
134
  (@create + @update).each_slice(MAX_TO_BATCH_AT_A_TIME) do |records|
133
- begin
134
- xml = {:options => @options['remote_options'], :records => records}.to_xml
135
- response = resource.post(:batch, {}, xml)
136
- rescue ActiveResource::TimeoutError
137
- retries -= 1
138
- if retries > 0
139
- puts "ActiveResource::TimeoutError with xml:\n#{xml}\n\nwill retry #{retries} more time(s) after 10 seconds..."
140
- sleep 10
141
- retry
135
+ post_succeeded = false
136
+ response = nil
137
+ RETRIES.times do |i|
138
+ begin
139
+ xml = {:options => @options['remote_options'], :records => records}.to_xml
140
+ response = resource.post(:batch, {}, xml)
141
+ rescue ActiveResource::TimeoutError, ActiveResource::ServerError
142
+ puts "ActiveResource::TimeoutError with xml:\n#{xml}\n\n"
143
+ if i < RETRIES-1
144
+ puts "waiting for #{RETRY_SLEEP} seconds to retry..."
145
+ sleep RETRY_SLEEP
146
+ end
142
147
  else
143
- raise
148
+ post_succeeded = true
144
149
  end
150
+ break if post_succeeded
145
151
  end
152
+ exit(1) unless post_succeeded
146
153
  statuses = Hash.from_xml(response.body)['objects']
147
154
  statuses.each do |status|
148
155
  record = data_by_id[status['legacy_id'].to_i]
metadata CHANGED
@@ -1,49 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebody-updateagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
5
- prerelease:
4
+ version: 0.6.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Morgan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-24 00:00:00.000000000 Z
11
+ date: 2014-07-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fastercsv
16
- requirement: &11282520 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *11282520
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: highline
27
- requirement: &11282040 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *11282040
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: activeresource
38
- requirement: &11281400 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
43
47
  version: 2.3.14
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *11281400
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.14
47
55
  description:
48
56
  email: tim@timmorgan.org
49
57
  executables:
@@ -51,41 +59,41 @@ executables:
51
59
  extensions: []
52
60
  extra_rdoc_files: []
53
61
  files:
54
- - VERSION
55
- - example.yml
56
- - example.csv
57
62
  - README.markdown
63
+ - VERSION
58
64
  - bin/update_onebody
65
+ - example.csv
66
+ - example.yml
59
67
  - lib/onebody-updateagent.rb
68
+ - lib/updateagent/converters/acs_converter.rb
60
69
  - lib/updateagent/hash_extensions.rb
61
70
  - lib/updateagent/resources.rb
62
71
  - lib/updateagent/schema.rb
63
72
  - lib/updateagent/updateagent.rb
64
- - lib/updateagent/converters/acs_converter.rb
65
73
  - lib/updateagent/updaters/family_updater.rb
66
74
  - lib/updateagent/updaters/people_updater.rb
67
75
  homepage: http://github.com/seven1m/onebody-updateagent
68
76
  licenses: []
77
+ metadata: {}
69
78
  post_install_message:
70
79
  rdoc_options: []
71
80
  require_paths:
72
81
  - lib
73
82
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
83
  requirements:
76
- - - ! '>='
84
+ - - '>='
77
85
  - !ruby/object:Gem::Version
78
86
  version: '0'
79
87
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
88
  requirements:
82
- - - ! '>='
89
+ - - '>='
83
90
  - !ruby/object:Gem::Version
84
91
  version: '0'
85
92
  requirements: []
86
93
  rubyforge_project:
87
- rubygems_version: 1.8.10
94
+ rubygems_version: 2.2.2
88
95
  signing_key:
89
- specification_version: 3
96
+ specification_version: 4
90
97
  summary: Companion to OneBody that handles sync with external data source.
91
98
  test_files: []
99
+ has_rdoc: false