grape-batch 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c814c50a907a565423f1154df0315082ce01b368
4
- data.tar.gz: 3d6a2ecc29a6e0e11903c126618095c3154b6818
3
+ metadata.gz: bac086f102c0e6f7a25ccb1cff49caae216cefbb
4
+ data.tar.gz: 0dca92ed6c95d4dd984a536a41774a3517b579b5
5
5
  SHA512:
6
- metadata.gz: c0ca65a811be6de53282bf1b112195a06f6aaa0c922a5facee2f59c896f2bf346988d456a0a0bdc85c3eed09fccbd587dc395fcb27f3b61cffac75870515caa1
7
- data.tar.gz: 6e05351a95f28d24fe58451dfdc08f20fdb9ead667c4bdfdb0426124499b424e209e502c21fb861692036e4a79eaa12f210ac4727d1c3283af573b565458786a
6
+ metadata.gz: 5830ac465a1725e1135c370a6daf8f83c0c81aafd5ad2f06a9e0d3468395a06a4e2ea66284639fe0284bf17efcf26b91d1572194d68cc82f4706b1e4b997601e
7
+ data.tar.gz: cfcf71b8da3c1f9dc67f863f61a2c3562e932905766439c73bec4eac5d9baa52452fda0d980cad2ad24c7c2189da7ad7b4a8519cd709d0f25d7ef8f0e2cbbc0d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
+ # 1.2.1 (24rd July 2015)
2
+ * Using env['HTTP_X_REQUEST_ID'] or env['rack-timeout.info'][:id] or generate unique hex to identify request batch
3
+
1
4
  # 1.2.0 (23rd July 2015)
2
- * Removed logging
5
+ * Removed logging, added batch START and END logs
3
6
 
4
7
  # 1.1.4 (17th July 2015)
5
8
  * Added batch session
data/lib/grape/batch.rb CHANGED
@@ -23,7 +23,9 @@ module Grape
23
23
  def batch_call(env)
24
24
  status = 200
25
25
  headers = { 'Content-Type' => 'application/json' }
26
- logger.info('--- Grape::Batch BEGIN')
26
+ rack_timeout_info = env['rack-timeout.info'][:id] if env['rack-timeout.info']
27
+ request_id = env['HTTP_X_REQUEST_ID'] || rack_timeout_info || SecureRandom.hex
28
+ logger.info("--- Grape::Batch #{request_id} BEGIN")
27
29
  begin
28
30
  batch_requests = Grape::Batch::Validator::parse(env, Grape::Batch.configuration.limit)
29
31
  result = dispatch(env, batch_requests)
@@ -32,7 +34,7 @@ module Grape
32
34
  e.class == TooManyRequestsError ? status = 429 : status = 400
33
35
  body = e.message
34
36
  end
35
- logger.info('--- Grape::Batch END')
37
+ logger.info("--- Grape::Batch #{request_id} END")
36
38
  [status, headers, [body]]
37
39
  end
38
40
 
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Batch
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lionel Oto
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-23 00:00:00.000000000 Z
13
+ date: 2015-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack