This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Commit 7a138af
authored
event_logs, telemetry_export: do not interrupt insert on context cancel (#57552)
When a request context is cancelled, the [corresponding event database insert can fail on context cancellation](https://sourcegraph.slack.com/archives/C03V51C8K53/p1697072391851359) - but this is highly unlikely to be desirable behaviour, since we probably want to proceed with persisting the event regardless.
This change introduces a new helper in `internal/trace`, `BackgroundContext`, which aliases `CopyContext(context.Background(), from)` with some more docstrings on when to use it and how to use it correctly. We use this new background context in the most inner part of `(TelemetryEventsExportQueueStore).QueueForExport` and `(EventLogStore).BulkInsert` to ensure we don't interrupt database inserts.1 parent afd3156 commit 7a138af
File tree
3 files changed
+25
-2
lines changed- internal/database
3 files changed
+25
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
292 | 303 | | |
293 | | - | |
| 304 | + | |
294 | 305 | | |
295 | 306 | | |
296 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
94 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
| |||
0 commit comments