dor-services-client 3.7.0 → 3.8.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17d1bc1362286691b1f977cad23f8a4055fdd12009b23fb407c59813d302cbc3
|
4
|
+
data.tar.gz: a9279fc138723d1d9e6c9d3be6ef5de0736cbe06c5b03de72270b079e1336d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40fff715eb9581abefd027fbd29bb92b955cd6d15b77c525966313f35feccd72f7f4cf8443114938e952d74aba57811bc9ada622d5cd6f17dd90180e1ab146d2
|
7
|
+
data.tar.gz: '0483086f12869253fbeef14715703ed1c23ac74f8d068bd23a96c80f720a1188d0029f9f6c5d39b15d9da20a789d536da5bd468fcb35de608ae2fa779e6f4a54'
|
@@ -14,11 +14,16 @@ module Dor
|
|
14
14
|
@url = url
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# Polls using exponential backoff, so as not to overrwhelm the server.
|
18
|
+
# @param [Float] seconds_between_requests (3.0) initially, how many seconds between polling requests
|
18
19
|
# @param [Integer] timeout_in_seconds (180) timeout after this many seconds
|
20
|
+
# @param [Float] backoff_factor (2.0) how quickly to backoff. This should be > 1.0 and probably ought to be <= 2.0
|
19
21
|
# @return true if successful false if unsuccessful.
|
20
|
-
def wait_until_complete(seconds_between_requests: 3,
|
21
|
-
|
22
|
+
def wait_until_complete(seconds_between_requests: 3.0,
|
23
|
+
timeout_in_seconds: 180,
|
24
|
+
backoff_factor: 2.0,
|
25
|
+
max_seconds_between_requests: 60)
|
26
|
+
poll_until_complete(seconds_between_requests, timeout_in_seconds, backoff_factor, max_seconds_between_requests)
|
22
27
|
errors.nil?
|
23
28
|
end
|
24
29
|
|
@@ -34,12 +39,15 @@ module Dor
|
|
34
39
|
|
35
40
|
private
|
36
41
|
|
37
|
-
def poll_until_complete(seconds_between_requests, timeout_in_seconds)
|
42
|
+
def poll_until_complete(seconds_between_requests, timeout_in_seconds, backoff_factor, max_seconds_between_requests)
|
43
|
+
interval = seconds_between_requests
|
38
44
|
Timeout.timeout(timeout_in_seconds) do
|
39
45
|
loop do
|
40
46
|
break if complete?
|
41
47
|
|
42
|
-
sleep(
|
48
|
+
sleep(interval)
|
49
|
+
# Exponential backoff, limited to max_seconds_between_requests
|
50
|
+
interval = [interval * backoff_factor, max_seconds_between_requests].min
|
43
51
|
end
|
44
52
|
end
|
45
53
|
rescue Timeout::Error
|
@@ -70,12 +70,10 @@ module Dor
|
|
70
70
|
# @param [String] workflow ('accessionWF') which workflow to callback to.
|
71
71
|
# @return [boolean] true on success
|
72
72
|
def publish(workflow: nil)
|
73
|
-
|
74
|
-
|
75
|
-
Deprecation.warn(self, 'calling publish without passing a workflow is deprecated and will be removed in the next major version')
|
76
|
-
end
|
73
|
+
publish_path = "#{object_path}/publish"
|
74
|
+
publish_path = "#{publish_path}?workflow=#{workflow}" if workflow
|
77
75
|
resp = connection.post do |req|
|
78
|
-
req.url
|
76
|
+
req.url publish_path
|
79
77
|
end
|
80
78
|
return resp.headers['Location'] if resp.success?
|
81
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-11-
|
12
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|