Commit 083666d
Add thread-safe access to custom headers (#1235)
* Add thread-safe access to custom headers
Implement thread-safe custom headers to prevent race conditions when accessing headers from multiple threads. Uses a serial dispatch queue to synchronize all custom header operations.
Changes:
- Add customHeaderQueue dispatch queue for synchronization
- Add private _customHeaders backing storage
- Convert customHeaders to computed property with thread-safe getter/setter
- Update addCustomHeader() to use sync for thread-safe writes
- Update clearCustomHeaders() to use sync for thread-safe clearing
- Add getCustomHeaders() method for safe external access
- Update PrebidServerConnection to use getCustomHeaders() getter
The computed property approach maintains backward compatibility while ensuring all access (direct or via methods) goes through the synchronization queue.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* PR Comments
---------
Co-authored-by: athanekar <ankitrajendra.thanekar@yahooinc.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 0b0dc99 commit 083666d
1 file changed
+30
-8
lines changedLines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
138 | 150 | | |
139 | 151 | | |
140 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
141 | 159 | | |
142 | 160 | | |
143 | 161 | | |
| |||
170 | 188 | | |
171 | 189 | | |
172 | 190 | | |
173 | | - | |
174 | | - | |
| 191 | + | |
| 192 | + | |
175 | 193 | | |
176 | 194 | | |
177 | 195 | | |
178 | 196 | | |
179 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
180 | 200 | | |
181 | 201 | | |
182 | | - | |
| 202 | + | |
183 | 203 | | |
184 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
185 | 207 | | |
186 | | - | |
| 208 | + | |
187 | 209 | | |
188 | 210 | | |
189 | 211 | | |
| |||
0 commit comments