Skip to content

Resolve "Option to cancel processing a pdf"

Taico Aerts requested to merge t.v.aerts/zesje:578-cancel-scans into master

Adds the ability to cancel scans that are being processed. The taken approach allows us to cancel an individual scan without affecting other scans, even when running with multiple workers. This is because of sending a SIGUSR1 signal to the task which causes an exception which can be handled, rather than terminating the entire worker. From my local testing it seems that scans which run in parallel are unaffected.

This required a few changes:

  1. Store celery task id in database (migration)
  2. Add cancel endpoint (CancelScans, /api/scans/cancel/)
  3. Add handling of cancellation in scan processing (SIGUSR1 is used, which results in a SoftTimeLimitExceeded exception)
  4. Add cancel button + logic on scans page while a scan is running

I had to make the cancel button quite small to fit in the normal line of the scans.

image

image

image

Closes #578 Closes #690

Edited by Taico Aerts

Merge request reports