rails-profiler 0.44.17 → 0.44.18

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
  SHA256:
3
- metadata.gz: 35e6f32ca6ce4fe99441b079cd304f93539eacb3dffa267af96ce6945d14911b
4
- data.tar.gz: '014679015c78eb282be8f5ee19cb6a97be988f182ae91e1e7e33ddade5db3bd5'
3
+ metadata.gz: 136fdd7fd5d34a66aa87bd01e8cd55b2df26c3de03c988a733bade1a44a3034d
4
+ data.tar.gz: dd962de06e0747beb03bc6bee76d411a1bdf2c22c382991af55e977983119889
5
5
  SHA512:
6
- metadata.gz: e66c36f8ac5120128e2f1ac069fa770ba141ab707f63f072fac704258333be9175065ad3fcac9940ef2fdbd3a0c22dc50eb452fa7b06bd17df4985492545d66d
7
- data.tar.gz: 8637901e09759b2532300b92bbf9de2f0d4cd4ddf4aba1669cdc25b0ebc2ef2ca5045b0f91538e429d18d75f25301ebcb51f34f3e35b6acd31cd8db36a10b10c
6
+ metadata.gz: d96275cf8138715c6751b52e65c825d8afe8dd9c2e78615a2afd95e292b9eda8510998b90289f0758857cc47b9b2f0b7b4e2a1153ec01249f0612ed86e8837d5
7
+ data.tar.gz: 454845b2440625265337ade6fbf70a1b19dafe456d625654a5ad65c9702ce798c5ffba6297cf1475e1264024cfc6976a6b62679728e5e5c0a5bdcbb54a85fae3
data/CHANGELOG.md CHANGED
@@ -19,6 +19,14 @@ every commit of every tag interval is accounted for one way or the other.
19
19
 
20
20
  ## [Unreleased]
21
21
 
22
+ ## [0.44.18] - 2026-10-25
23
+
24
+ <!-- stamped -->
25
+
26
+ ### Fixed
27
+
28
+ - **AJAX interceptor:** Retry `/_profiler/api/ajax/link` with exponential backoff (100ms, 200ms, 400ms) on 404 errors, bounded to 3 attempts, to handle streaming response profiles not yet persisted when the client attachment request arrives. Refs #70
29
+
22
30
  ## [0.44.17] - 2026-10-25
23
31
 
24
32
  <!-- stamped -->
@@ -91,20 +91,20 @@
91
91
  }
92
92
  }
93
93
 
94
- // Helper function to link child profile to parent
95
- function linkChildProfile(childToken) {
94
+ // Helper function to link child profile to parent, with retry on 404
95
+ function linkChildProfile(childToken, attempt = 1) {
96
96
  const parentToken = currentParentToken();
97
97
  if (!childToken || !parentToken) return;
98
98
 
99
- console.debug('[Profiler] Linking AJAX request:', { parent: parentToken, child: childToken });
100
-
101
- // Post to the link API endpoint
99
+ const maxAttempts = 3;
102
100
  const linkUrl = '/_profiler/api/ajax/link';
103
101
  const body = JSON.stringify({
104
102
  parent_token: parentToken,
105
103
  child_token: childToken
106
104
  });
107
105
 
106
+ console.debug('[Profiler] Linking AJAX request:', { parent: parentToken, child: childToken, attempt });
107
+
108
108
  // Use original fetch to avoid infinite loop
109
109
  originalFetch.call(window, linkUrl, {
110
110
  method: 'POST',
@@ -122,6 +122,16 @@
122
122
  window.__PROFILER_REFRESH_TOOLBAR__();
123
123
  }
124
124
  }, 100);
125
+ } else if (response.status === 404 && attempt < maxAttempts) {
126
+ // Profile not yet persisted (streaming response case): retry with exponential backoff
127
+ const backoffMs = 100 * Math.pow(2, attempt - 1); // 100ms, 200ms, 400ms
128
+ console.debug('[Profiler] Profile not found (404), retrying in', backoffMs, 'ms');
129
+ setTimeout(() => {
130
+ linkChildProfile(childToken, attempt + 1);
131
+ }, backoffMs);
132
+ } else if (response.status === 404) {
133
+ // Exhausted retries
134
+ console.debug('[Profiler] Profile not found after', maxAttempts, 'retries, giving up');
125
135
  }
126
136
  }).catch(err => {
127
137
  // Fail silently - don't break the page if profiler API fails
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Profiler
4
- VERSION = "0.44.17"
4
+ VERSION = "0.44.18"
5
5
 
6
6
  GEM_ROOT = File.expand_path("../..", __dir__)
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.17
4
+ version: 0.44.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Duplessy