embulk-input-marketo 0.2.3 → 0.2.4

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: 5485d5527116194e9cf43129e39a686675038d35
4
- data.tar.gz: 932cd341055835466e2022c950babd2c0f7966ae
3
+ metadata.gz: 91632886c4d5a336024869408d4d1d877aa05882
4
+ data.tar.gz: 22c4f6b1fdba1db3ff1f00898becd767f91655c8
5
5
  SHA512:
6
- metadata.gz: 31b2aa93cbb0e301b1a71fbf15c0b53f0841558aaeafb8e5d38ce884fd6cd9d34c34bc7d44678d57421e47f10739748b9815e523dffd956a6c9c76d7ebe50e41
7
- data.tar.gz: b25b1163d52542cf8f284396f36e428fb55a35f1f4418784b93885cc678cc2fd320d53c98ea6648b8ace4dab920e431e447a60747295cf18e238dbcc2a2a2c76
6
+ metadata.gz: 3aef455faff03669b183c791c58d9643e180d29ec2d87c103dcaf6833129e9fa5efe45d970d639c65244a67324fd32b1e7c91f236be6cfbc83bb957a2082891a
7
+ data.tar.gz: 61dfcebdd98dbfccd44b0842b88a4aee32b01311bb40853e3bc9dd71b9cfe5435373d504550ebf188076a18b10db15a0d0f1cbde18e06f976a7112f7f05067f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.4 - 2015-09-17
2
+
3
+ * [enhancement] Retry to call API until 5 times when Timeout [#36](https://github.com/treasure-data/embulk-input-marketo/pull/36) [[Reported by @muga](https://github.com/treasure-data/embulk-input-marketo/issues/34). Thanks!]
4
+
1
5
  ## 0.2.3 - 2015-09-14
2
6
 
3
7
  * [enhancement] Catch config error [#33](https://github.com/treasure-data/embulk-input-marketo/pull/33)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-marketo"
3
- spec.version = "0.2.3"
3
+ spec.version = "0.2.4"
4
4
  spec.authors = ["uu59", "yoshihara"]
5
5
  spec.summary = "Marketo input plugin for Embulk"
6
6
  spec.description = "Loads records from Marketo."
@@ -7,6 +7,8 @@ module Embulk
7
7
  class Base
8
8
  attr_reader :endpoint, :wsdl, :user_id, :encryption_key
9
9
 
10
+ RETRY_TIMEOUT_COUNT = 5
11
+
10
12
  def initialize(endpoint, wsdl, user_id, encryption_key)
11
13
  @endpoint = endpoint
12
14
  @wsdl = wsdl
@@ -40,7 +42,9 @@ module Embulk
40
42
 
41
43
  def savon_call(operation, locals={})
42
44
  catch_unretryable_error do
43
- savon.call(operation, locals.merge(advanced_typecasting: false))
45
+ with_retry do
46
+ savon.call(operation, locals.merge(advanced_typecasting: false))
47
+ end
44
48
  end
45
49
  end
46
50
 
@@ -55,6 +59,18 @@ module Embulk
55
59
  }
56
60
  end
57
61
 
62
+ def with_retry(&block)
63
+ count = 0
64
+ begin
65
+ yield
66
+ rescue ::Timeout::Error => e
67
+ count += 1
68
+ raise e if count > RETRY_TIMEOUT_COUNT
69
+ Embulk.logger.warn "TimeoutError [#{count}/#{RETRY_TIMEOUT_COUNT}]. Retrying..."
70
+ retry
71
+ end
72
+ end
73
+
58
74
  def catch_unretryable_error(&block)
59
75
  yield
60
76
  rescue Savon::SOAPFault => e
@@ -8,6 +8,18 @@ module Embulk
8
8
  class BaseTest < Test::Unit::TestCase
9
9
  include LeadFixtures
10
10
 
11
+ def test_with_retry
12
+ any_instance_of(Savon::Client) do |klass|
13
+ stub(klass).call(:timeout_test, advanced_typecasting: false) { raise ::Timeout::Error }
14
+ end
15
+
16
+ mock(Embulk.logger).warn(/TimeoutError/).times(Base::RETRY_TIMEOUT_COUNT)
17
+
18
+ assert_raise(::Timeout::Error) do
19
+ soap.send(:savon_call, :timeout_test)
20
+ end
21
+ end
22
+
11
23
  class TestSignature < self
12
24
  def setup
13
25
  @signature = soap.__send__(:signature)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-marketo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-14 00:00:00.000000000 Z
12
+ date: 2015-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement