kennel 1.148.0 → 1.149.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: 4a544470a54c1480f1ed92be13555d44349eb59405c0f2620f00645f536be10d
4
- data.tar.gz: 5425b8bf340f5956d87ad6cd08e26c4e8c70d066cf05f70b7b7df6d0816b0f30
3
+ metadata.gz: dca468d8f965e5b3ed1e1bb74610a1f5fd9b66bca5269286f5edb48dbc7d552d
4
+ data.tar.gz: 91d9a7a9c1e0e9aefa052e3673fb1239d2a61bf3387c10c4c323094ba91faca0
5
5
  SHA512:
6
- metadata.gz: b07268a2f09ccb5465afab53a6ee3bdc8448ffa223d092496a04d6fb5c4d704c593df35d69555d0b021bf13f7068bf102332eaaa3412f62dc39c65979744460c
7
- data.tar.gz: f15042a4259a60a8a69fa7c57aa5d12b1ec1fee7e8ba20fc053ab87742b5fa9eb1ce1b66bfd856f2a5ad098b614d5996450d2fae4971ba5a6a22912a084fea0f
6
+ metadata.gz: 7b72426c08a25c1c7fd86a7193420a5b1ca5f8fca102087d021f1944b688d8d9fdd58fe1f3feb23355ddf8eed9196b8b4a96b5284942e9755d01b3ce0d9bb201
7
+ data.tar.gz: 374585d70647bed669a87039cc96c01db509ceb5d953b526e47da8b1883a5f5e1ced444a289e73f1e602ba2f64f95984a1088c5f0f35ca35299fe993a42f8244
data/lib/kennel/api.rb CHANGED
@@ -5,6 +5,8 @@ module Kennel
5
5
  class Api
6
6
  CACHE_FILE = ENV.fetch("KENNEL_API_CACHE_FILE", "tmp/cache/details")
7
7
 
8
+ RateLimitParams = Data.define(:limit, :period, :remaining, :reset, :name)
9
+
8
10
  def self.tag(api_resource, reply)
9
11
  klass = Models::Record.api_resource_map[api_resource]
10
12
  return reply unless klass # do not blow up on unknown models
@@ -122,6 +124,23 @@ module Kennel
122
124
  end
123
125
  end
124
126
 
127
+ rate_limit = RateLimitParams.new(
128
+ limit: response.headers["x-ratelimit-limit"],
129
+ period: response.headers["x-ratelimit-period"],
130
+ remaining: response.headers["x-ratelimit-remaining"],
131
+ reset: response.headers["x-ratelimit-reset"],
132
+ name: response.headers["x-ratelimit-name"]
133
+ )
134
+
135
+ if response.status == 429
136
+ message = "Datadog rate limit #{rate_limit.name.inspect} hit"
137
+ message += " (#{rate_limit.limit} requests per #{rate_limit.period} seconds)"
138
+ message += "; sleeping #{rate_limit.reset} seconds before trying again"
139
+ Kennel.err.puts message
140
+ sleep rate_limit.reset.to_f
141
+ redo
142
+ end
143
+
125
144
  break if i == tries - 1 || method != :get || response.status < 500
126
145
  Kennel.err.puts "Retrying on server error #{response.status} for #{path}"
127
146
  end
@@ -22,11 +22,19 @@ module Kennel
22
22
 
23
23
  def print_changes(step, list, color)
24
24
  return if list.empty?
25
+
26
+ use_groups = ENV.key?("GITHUB_STEP_SUMMARY")
27
+
25
28
  list.each do |item|
29
+ # No trailing newline
30
+ Kennel.out.print "::group::" if item.class::TYPE == :update && use_groups
31
+
26
32
  Kennel.out.puts Console.color(color, "#{step} #{item.api_resource} #{item.tracking_id}")
27
33
  if item.class::TYPE == :update
28
34
  item.diff.each { |args| Kennel.out.puts @attribute_differ.format(*args) } # only for update
29
35
  end
36
+
37
+ Kennel.out.puts "::endgroup::" if item.class::TYPE == :update && use_groups
30
38
  end
31
39
  end
32
40
  end
data/lib/kennel/tasks.rb CHANGED
@@ -91,8 +91,8 @@ namespace :kennel do
91
91
 
92
92
  if bad.any?
93
93
  url = Kennel::Utils.path_to_url "/account/settings"
94
- Kennel.out.puts "Invalid mentions found, either ignore them by adding to `KNOWN` env var or add them via #{url}"
95
- bad.each { |f, v| Kennel.out.puts "Invalid mention #{v} in monitor message of #{f}" }
94
+ Kennel.err.puts "Invalid mentions found, either ignore them by adding to `KNOWN` env var or add them via #{url}"
95
+ bad.each { |f, v| Kennel.err.puts "Invalid mention #{v} in monitor message of #{f}" }
96
96
  Kennel::Tasks.abort ENV["KNOWN_WARNING"]
97
97
  end
98
98
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.148.0"
3
+ VERSION = "1.149.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.148.0
4
+ version: 1.149.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2024-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs