-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
164 lines (158 loc) · 3.81 KB
/
Rakefile
File metadata and controls
164 lines (158 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
desc "Elicit a Shopify rate limit"
task :rate_limit do
require "shopify_api/graphql/tiny"
query =<<-GQL
query {
products(first: 50, sortKey: UPDATED_AT, reverse: true) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
title
handle
status
createdAt
updatedAt
publishedAt
vendor
productType
tags
descriptionHtml
description
onlineStoreUrl
options(first: 3) {
id
name
position
values
}
variants(first: 80) {
edges {
node {
id
title
price
compareAtPrice
sku
barcode
inventoryItem {
id
unitCost {
amount
currencyCode
}
countryCodeOfOrigin
harmonizedSystemCode
}
inventoryPolicy
taxable
availableForSale
metafields(first: 20) {
edges {
node {
id
namespace
key
value
type
description
}
}
}
}
}
}
media(first: 20) {
edges {
node {
__typename
alt
status
... on MediaImage {
id
preview {
image {
url
}
}
image {
id
url
width
height
altText
}
}
... on Video {
id
sources {
url
format
height
width
}
}
... on ExternalVideo {
id
originUrl
embedUrl
}
}
}
}
images(first: 20) {
edges {
node {
id
url
altText
width
height
}
}
}
seo {
title
description
}
metafields(first: 30) {
edges {
node {
id
namespace
key
value
type
ownerType
}
}
}
collections(first: 10) {
edges {
node {
id
title
handle
}
}
}
}
}
}
}
GQL
threads = 5.times.map do
Thread.new do
gql = ShopifyAPI::GQL::Tiny.new(ENV.fetch("SHOPIFY_DOMAIN"), ENV.fetch("SHOPIFY_TOKEN"), :debug => true)
pp gql.execute(query).dig("extensions", "cost", "throttleStatus")
end
end
threads.each(&:join)
end