allow disabling crocodoc polling job

closes CNVS-38714

test plan:
- enable the crocodoc plugin with a bogus api key
- notice that the CrocodocDocument.update_process_states runs and fails
- check the box to disable polling in the plugin
- the job should stop failing

Change-Id: I365ceeba2d83e4d2ec66ed8e977ba7798a58a960
Reviewed-on: https://gerrit.instructure.com/123017
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2017-08-16 13:56:41 -06:00
parent affa953f61
commit ce5e54076b
2 changed files with 5 additions and 1 deletions

View File

@ -27,6 +27,10 @@
<td><%= f.blabel :api_key, :en => "Crocodoc API Key" %></td>
<td><%= f.text_field :api_key %></td>
</tr>
<tr>
<td><%= f.blabel :disable_polling, :en => "Disabling polling for document status" %></td>
<td><%= f.check_box :disable_polling %></td>
</tr>
</table>
<% end %>

View File

@ -74,7 +74,7 @@ Rails.configuration.after_initialize do
end
Delayed::Periodic.cron 'CrocodocDocument.update_process_states', '*/10 * * * *' do
if Canvas::Crocodoc.config
if Canvas::Crocodoc.config && !Canvas::Plugin.value_to_boolean(Canvas::Crocodoc.config['disable_polling'])
with_each_shard_by_database(CrocodocDocument, :update_process_states)
end
end