Commit 61086db
authored
Improve backend error tolerance (#33)
* Update SQS test to reflect resizable concurrency pool signature
* Improve SQS broker reliability when backend returns errors
Originally, the SQS broker created a goroutine with an infinite loop. That
goroutine would poll SQS and put any received messages on a channel. A separate
goroutine would poll that channel, spawning a goroutine for any received items.
A separate channel reported errors between these different goroutines. In
theory, all the goroutines would listen for channel closure and error channel
items to handle errors. Unfortunately, if the backend reports errors then
polling the queue would quickly stop, because in this case the currency pool
wasn't properly returned.
To address this, the multiple goroutines are collapsed. When the initial
pollying goroutine receives a message, it immediately spawns a goroutine to
process that message, rather than using a channel and intermediate goroutine.
In addition, it always returns to the concurrency pool immediately after either
encountering an error or processing a message. This allows polling and
processing to continue even if the backend reports an error.1 parent 6c32ce7 commit 61086db
3 files changed
+51
-81
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 72 | + | |
80 | 73 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 74 | + | |
86 | 75 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 76 | + | |
92 | 77 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
96 | 85 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | | - | |
103 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
104 | 115 | | |
| 116 | + | |
| 117 | + | |
105 | 118 | | |
106 | 119 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| |||
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | 243 | | |
251 | 244 | | |
252 | 245 | | |
| |||
390 | 383 | | |
391 | 384 | | |
392 | 385 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | 386 | | |
422 | 387 | | |
423 | 388 | | |
| |||
432 | 397 | | |
433 | 398 | | |
434 | 399 | | |
435 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
436 | 403 | | |
437 | 404 | | |
438 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
178 | | - | |
| 180 | + | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| |||
0 commit comments