Just a suggestion, I think it would be better to add method `#running?` to the task and then 
```ruby
running = @provider.discovery_task.try :running?
```