breezy_pdf 0.0.16 → 0.0.17

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
  SHA1:
3
- metadata.gz: 762863805d9fbb8d35df18758beda176b0d50d4c
4
- data.tar.gz: f674de70104e792945f1a9482331cf3154875473
3
+ metadata.gz: 22152e31ae48f2787e5860af3c1fbd2f27b1108b
4
+ data.tar.gz: 461a8f053a29e9a761f4ca645f1545a120a28ae7
5
5
  SHA512:
6
- metadata.gz: 39aff3f2f39f8e685abb5dae0f00dacac3f6bc580c1877e14574200b284636e2ea46f6693b2358540733b6cccf06109b78d91cc14b2c1e543ba0977c251c6b7f
7
- data.tar.gz: 3cb320f2a666c40d9f526313e9682fcef067252a68c1030792b757cad41ea44109722d0e31c8499b57d8afded7feb9ff427be273283b7a802733f571bc3da142
6
+ metadata.gz: dde4a034799d9408d8b7a6206b30532a834cdd35b45f7acdbe2dfc09e9a5f0bf8602157d41b6f6f2c6a773b1049a54ff3bd21fc36b959cecc86c15e4ba1ac054
7
+ data.tar.gz: cb25cf71e8379d207c5f7811541d47708e12fec3e5f6df173dae8692042d1decf4d7ab3f04a68ec5f153e4b65ed32a1ac63d93e980614bc08c52c20efcf05088
@@ -8,11 +8,13 @@ module BreezyPDF::HTML
8
8
  @html_fragment = html_fragment
9
9
  @log_queue = []
10
10
  @upload_ids = []
11
+ @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
11
12
  end
12
13
 
13
14
  def public_fragment
14
15
  @public_fragment ||= parsed_document.tap do
15
16
  publicize!
17
+ BreezyPDF.logger.info("[BreezyPDF] Replaced assets in `#{timing} seconds`")
16
18
  end.to_html
17
19
  end
18
20
 
@@ -22,6 +24,10 @@ module BreezyPDF::HTML
22
24
  @upload_ids
23
25
  end
24
26
 
27
+ def timing
28
+ @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
29
+ end
30
+
25
31
  private
26
32
 
27
33
  def publicize!
@@ -5,14 +5,20 @@ module BreezyPDF::HTML
5
5
  class Strip
6
6
  def initialize(html_fragment)
7
7
  @html_fragment = html_fragment
8
+ @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
8
9
  end
9
10
 
10
11
  def stripped_fragment
11
12
  @stripped_fragment ||= parsed_document.tap do
12
13
  strip!
14
+ BreezyPDF.logger.info("[BreezyPDF] Stripped out elements in `#{timing} seconds`")
13
15
  end.to_html
14
16
  end
15
17
 
18
+ def timing
19
+ @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
20
+ end
21
+
16
22
  private
17
23
 
18
24
  def strip!
@@ -8,10 +8,15 @@ module BreezyPDF::Intercept
8
8
  def initialize(app, env)
9
9
  @app = app
10
10
  @env = env
11
+ @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
11
12
  end
12
13
 
13
14
  private
14
15
 
16
+ def timing
17
+ @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
18
+ end
19
+
15
20
  def metadata
16
21
  {
17
22
  "requested_url" => requested_url, "rendered_url" => rendered_url
@@ -12,6 +12,7 @@ module BreezyPDF::Intercept
12
12
 
13
13
  render_request = BreezyPDF::RenderRequest.new(public_url, metadata).submit
14
14
 
15
+ BreezyPDF.logger.info("[BreezyPDF] Completed request intercept in #{timing} seconds")
15
16
  BreezyPDF.logger.info("[BreezyPDF] Redirect to pdf at #{render_request.download_url}")
16
17
  [
17
18
  302,
@@ -34,7 +34,17 @@ module BreezyPDF::Resources
34
34
  end
35
35
 
36
36
  def io_object
37
- @io_object ||= open(asset_url)
37
+ @io_object ||= download_asset_from_url
38
+ end
39
+
40
+ def download_asset_from_url
41
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
42
+ asset_object = open(asset_url)
43
+ timing = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time
44
+
45
+ BreezyPDF.logger.info("[BreezyPDF] Downloading #{filename} took `#{timing} seconds`")
46
+
47
+ asset_object
38
48
  end
39
49
 
40
50
  def asset_url
@@ -7,14 +7,20 @@ module BreezyPDF::Uploads
7
7
  @filename = filename
8
8
  @content_type = content_type
9
9
  @file_path = file_path
10
+
11
+ @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
10
12
  end
11
13
 
12
14
  def public_url
15
+ @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
13
16
  BreezyPDF.logger.info(%([BreezyPDF] Starting private asset upload for #{@filename}))
14
17
  upload!
15
18
  complete_upload!
16
19
 
17
- BreezyPDF.logger.info(%([BreezyPDF] Private asset upload for #{@filename} completed))
20
+ @end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
21
+ BreezyPDF.logger.info(
22
+ %([BreezyPDF] Private asset upload for #{@filename} completed in #{timing} seconds)
23
+ )
18
24
  resource.presigned_url
19
25
  end
20
26
 
@@ -22,6 +28,10 @@ module BreezyPDF::Uploads
22
28
  resource.id
23
29
  end
24
30
 
31
+ def timing
32
+ @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
33
+ end
34
+
25
35
  private
26
36
 
27
37
  def client
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BreezyPDF
4
- VERSION = "0.0.16"
4
+ VERSION = "0.0.17"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breezy_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf