lucid-shopify 0.53.0 → 0.54.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lucid/shopify/bulk_request.rb +8 -4
- data/lib/lucid/shopify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b8e5b6fbcfc27b35f4a42b7ddf072c06424d7e194407f31a4869d3876280c51
|
4
|
+
data.tar.gz: 5bf6322be4b32821508883d4ebbad90279357a8e578c1d808befdf0b1071342e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4885a6adefc994b3d0f39159a1dc93cd76d83e88f506866f0e801aa62e9cf9e5b539e122f0595776da2464a0374393ba62e102174da6961cc11809b7d3f89920
|
7
|
+
data.tar.gz: ecd9a0251f1d4e7be6afcacaf218b621d9b111d560ed30ee9075140a3406fd4a2c0eb74edb31bfc2832cef049e13300632f01e6810892063f43b2b4edb9cad29
|
@@ -48,10 +48,11 @@ module Lucid
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# @param query [String] the GraphQL query
|
51
|
+
# @param delay [Integer] delay between polling requests in seconds
|
51
52
|
# @param http [HTTP::Client]
|
52
53
|
#
|
53
54
|
# @yield [Hash] each parsed line of JSONL (streamed to limit memory usage)
|
54
|
-
def call(query, http: Container[:http], &block)
|
55
|
+
def call(query, delay: 1, http: Container[:http], &block)
|
55
56
|
id = client.post_graphql(credentials, <<~QUERY)['data']['bulkOperationRunQuery']['bulkOperation']['id']
|
56
57
|
mutation {
|
57
58
|
bulkOperationRunQuery(
|
@@ -70,7 +71,7 @@ module Lucid
|
|
70
71
|
}
|
71
72
|
QUERY
|
72
73
|
|
73
|
-
url = poll(id)
|
74
|
+
url = poll(id, delay: delay)
|
74
75
|
|
75
76
|
# TODO: Verify signature?
|
76
77
|
|
@@ -93,9 +94,10 @@ module Lucid
|
|
93
94
|
end
|
94
95
|
|
95
96
|
# @param id [Integer] of the bulk operation
|
97
|
+
# @param delay [Integer]
|
96
98
|
#
|
97
99
|
# @return [String] the download URL
|
98
|
-
private def poll(id)
|
100
|
+
private def poll(id, delay:)
|
99
101
|
op = client.post_graphql(credentials, <<~QUERY)['data']['currentBulkOperation']
|
100
102
|
{
|
101
103
|
currentBulkOperation {
|
@@ -118,7 +120,9 @@ module Lucid
|
|
118
120
|
when 'COMPLETED'
|
119
121
|
op['url']
|
120
122
|
else
|
121
|
-
|
123
|
+
sleep(delay)
|
124
|
+
|
125
|
+
poll(id, delay: delay)
|
122
126
|
end
|
123
127
|
end
|
124
128
|
end
|