1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
3
< head >
4
- < link rel ="preconnect " href ="https://fonts.googleapis.com " />
5
- < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin />
6
- < link
7
- href ="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;700&family=Work+Sans:wght@400;700&display=auto "
8
- rel ="stylesheet "
9
- />
4
+ < link rel ="preconnect " href ="https://fonts.googleapis.com ">
5
+ < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin >
6
+ < link href ="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap " rel ="stylesheet ">
10
7
< link rel ="icon " type ="image/png " href ="/images/favicon.png " sizes ="32x32 " />
11
8
< title > CodeSignal Webhook API</ title >
12
9
< meta
@@ -40,7 +37,7 @@ <h2>Table of Contents</h2>
40
37
< ul >
41
38
< li > < a href ="#auth "> Authentication</ a > </ li >
42
39
< li > < a href ="#eventhandling "> Event handling</ a > </ li >
43
- < li > < a href ="#retry "> Retry policy</ a > </ li >
40
+ < li > < a href ="#retry "> Errors and retry policy</ a > </ li >
44
41
< li > < a href ="#payloads "> Webhook payloads</ a > </ li >
45
42
</ ul >
46
43
< li > Events for CodeSignal Assessments</ li >
@@ -222,13 +219,24 @@ <h3 id="eventhandling">Event handling</h3>
222
219
</ p >
223
220
</ div >
224
221
< div class ="subsection ">
225
- < h3 id ="retry "> Retry policy</ h3 >
222
+ < h3 id ="retry "> Errors and retry policy</ h3 >
226
223
< div >
227
- In the event of a failed webhook (due to timeout, a status code other than 200, or
228
- network issues), CodeSignal will attempt a maximum of 25 retries with exponential
229
- backoff according to the formula below. The number of seconds to wait is relative to
230
- the last failed attempt.
231
- < pre > < code > secondsToWait = failCount^4 + 15 + (random(30) * (failCount + 1))</ code > </ pre >
224
+ < p >
225
+ If CodeSignal receives any response other than a 200 OK from the endpoint,
226
+ the endpoint will be marked unhealthy, and CodeSignal will attempt to resend the
227
+ event after a delay (up to 25 attempts total).
228
+ </ p >
229
+ < p >
230
+ CodeSignal is looking for a 200 OK response from the endpoint URL in order to continue processing
231
+ further events. Do < em > not</ em > return 400 errors; they will not be respected and the webhook
232
+ will be flagged as unhealthy. Instead, keep error-handling logic internal to your endpoint.
233
+ </ p >
234
+ < p >
235
+ The delay is calculated using an exponential backoff strategy. In other words,
236
+ the retry window will be short at first but will increase if the endpoint keeps failing.
237
+ The delay between each failure and the next attempt is calculated with the formula below.
238
+ </ p >
239
+ < pre > < code > secondsToWait = (failCount - 1)^4 + 15 + (random(30) * failCount)</ code > </ pre >
232
240
</ div >
233
241
< p >
234
242
Assuming that < span class ="mono "> random(30)</ span > always returns its average of 15,
@@ -238,75 +246,84 @@ <h3 id="retry">Retry policy</h3>
238
246
< table >
239
247
< thead >
240
248
< tr >
241
- < th align ="center "> Previous failed attempts</ th >
242
- < th align ="center "> Time since last attempt</ th >
243
- < th align ="center "> Time since first attempt</ th >
249
+ < th align ="center "> Total failed attempts</ th >
250
+ < th align ="center "> Time until next attempt</ th >
251
+ < th align ="center "> Time until next attempt, from first failure </ th >
244
252
</ tr >
245
253
</ thead >
246
254
< tbody >
247
255
< tr >
248
- < td align ="center "> 0 </ td >
256
+ < td align ="center "> 1 </ td >
249
257
< td align ="center "> 30 seconds</ td >
250
258
< td align ="center "> 30 seconds</ td >
251
259
</ tr >
252
260
< tr >
253
- < td align ="center "> 1 </ td >
261
+ < td align ="center "> 2 </ td >
254
262
< td align ="center "> 46 seconds</ td >
255
263
< td align ="center "> 1.3 minutes</ td >
256
264
</ tr >
257
265
< tr >
258
- < td align ="center "> 2 </ td >
266
+ < td align ="center "> 3 </ td >
259
267
< td align ="center "> 1.2 minutes</ td >
260
268
< td align ="center "> 2.5 minutes</ td >
261
269
</ tr >
262
270
< tr >
263
- < td align ="center "> 3 </ td >
271
+ < td align ="center "> 4 </ td >
264
272
< td align ="center "> 2.6 minutes</ td >
265
273
< td align ="center "> 5.1 minutes</ td >
266
274
</ tr >
267
275
< tr >
268
- < td align ="center "> 5 </ td >
276
+ < td align ="center "> 6 </ td >
269
277
< td align ="center "> 12.2 minutes</ td >
270
278
< td align ="center "> 23 minutes</ td >
271
279
</ tr >
272
280
< tr >
273
- < td align ="center "> 10 </ td >
281
+ < td align ="center "> 11 </ td >
274
282
< td align ="center "> 2.8 hours</ td >
275
283
< td align ="center "> 7.4 hours</ td >
276
284
</ tr >
277
285
< tr >
278
- < td align ="center "> 13 </ td >
286
+ < td align ="center "> 14 </ td >
279
287
< td align ="center "> 8 hours</ td >
280
288
< td align ="center "> 1 day</ td >
281
289
</ tr >
282
290
< tr >
283
- < td align ="center "> 15 </ td >
291
+ < td align ="center "> 16 </ td >
284
292
< td align ="center "> 14 hours</ td >
285
293
< td align ="center "> 2.1 days</ td >
286
294
</ tr >
287
295
< tr >
288
296
< td align ="center "> 24</ td >
289
- < td align ="center "> 3.8 days</ td >
290
- < td align ="center "> 20.5 days</ td >
297
+ < td align ="center "> 3.2 days</ td >
298
+ < td align ="center "> 16.6 days</ td >
299
+ </ tr >
300
+ < tr >
301
+ < td align ="center "> 25</ td >
302
+ < td align ="center "> n/a</ td >
303
+ < td align ="center "> n/a</ td >
291
304
</ tr >
292
305
</ tbody >
293
306
</ table >
294
307
< p >
295
308
After the first few retries CodeSignal will also send an email notification to the
296
309
owner emails associated with the webhook, if any. To make sure we don't spam you,
297
- CodeSignal will send at most one email a day for every webhook. This means that you
298
- will generally be notified about the 5th fail, the 14th fail, and every fail
299
- starting from the 16th.
310
+ CodeSignal will only send emails for each webhook after the 5th failure, the 14th failure,
311
+ and every failure starting from the 16th.
300
312
</ p >
301
313
< p >
302
314
When a webhook is unhealthy, events will be queued in the order they were triggered,
303
- and the queue will not be flushed until the first event in the queue is able to be
315
+ and the queue will not be flushed until the first event in the queue can be
304
316
processed successfully (by receiving a 200 OK response from the endpoint URL). If
305
317
you are able to identify and resolve the issue with the endpoint URL, you can open
306
318
the webhook settings modal, then test and save the fixed webhook in order to mark it
307
319
as healthy again. Once it is marked as healthy, the webhook will immediately flush
308
320
its queue of pending events.
309
321
</ p >
322
+ < p >
323
+ After 25 consecutive failed delivery attempts, the webhook will be disabled and the
324
+ events queue will be cleared. You can re-enable the webhook after updating the endpoint
325
+ to return a valid 200 OK response.
326
+ </ p >
310
327
</ div >
311
328
< div class ="subsection ">
312
329
< h3 id ="payloads "> Webhook payloads</ h3 >
0 commit comments