Katello 4.1.2.1-1 Discover task does not cancel when repository discovery is cancelled

Problem:

After manually cancelling a “Repository Discovery” operation a “Discover” task remains in a Running state and continues to make requests to the External Repository.

Subsequent “Products” > “Repository Discovery” runs will add to the number of running “Discover” tasks

Expected outcome:

I was expecting the Discover task to cancel when I clicked cancel on the “Repository Discovery” page

As a workaround I have tested that the running “Discover” tasks can successfully be cancelled manually in the “Monitor” > “Tasks” page

Foreman and Proxy versions:
katello-4.1.2.1-1
foreman-2.5.2-1
foreman-proxy-2.5.2-1

Foreman and Proxy plugin versions:
N/A

Distribution and version:
CentOS Linux release 7.9.2009 (Core)

Other relevant data:
N/A