opengovsg / FormSG

Form builder for the Singapore Government
https://form.gov.sg
Other
260 stars 78 forks source link

fix(attachment): convoy separation #7449

Closed KenLSM closed 2 weeks ago

KenLSM commented 2 weeks ago

Problem

Closes FRM-1757

Admins are not able to receive all the download responses when clicking download with CSV.

Most modern browser blocks sequential downloads that run in quick successions.

Symptoms

Solution

Implementation of convoy separation.

Downloads are grouped into convoys where the front of the convoy must be x ms away from the next convoy.

[ o . o . . o o o ] . . [ o o o . . o . o] [ o o o o ]
  ^                       ^                  ^
  1st convoy              2nd convoy         3rd convoy                  

CONVOY_SIZE = 5
The time between each convoy should X amount of distance away to avoid a flood
3rd Convoy is too close and thus will be forced to wait

[ o . o . . o o o ] . . [ o o o . . o . o] . . . . [ o o o o ]
  ^                       ^                          ^
  1st convoy              2nd convoy                 3rd convoy

Additional Context

Total responses = 44 Experiments:

Control Group

Batch delay

Convoy delay (CONVOY_SIZE = 7)

Convoy delay (CONVOY_SIZE = 5)

Tests

Regression on large submissions >10 crossing two convoys

Regression on small submissions < 10

linear[bot] commented 2 weeks ago

FRM-1757 Browser blocks admin response download when too many downloads triggered too quickly