canvas-lms/lib
Brian Palmer 6f9be4fd13 use Oj for parsing and serializing json requests/responses
closes CNVS-9074

In rails2, we explicitly override `render :json` to use Oj and the
ParamsParser middleware to parse with Oj.

In rails3, we enable the oj backend for ActiveSupport::JSON. However,
sadly that's not enough because of the screwy state of JSON in Rails 3
and Rails 4.0.x. So we pull in the rails-patch-json-encode gem to fix
performance. If this ends up causing issues as we continue working
toward Rails 3.2, we'll remove this gem. A good explantion of the issues
is in the README: https://github.com/GoodLife/rails-patch-json-encode

In my local (rails2) benchmarking, json response generation is 12-14x faster
*with stringify ids* enabled. It'll be slightly faster without, but
stringify is becoming the norm. json parsing is a smaller win, 2-3x
faster, but still significant enough to warrant patching ParamsParser
(said patch goes away in rails3).

test plan:
* no behavior changes are expected
* regression testing of the api, both the json responses and sending
  json to put/post requests
* regression testing of the web ui in areas that use the api and ajax
  calls

Change-Id: I632549baaa4e51dd0ee67dede911941877911102
Reviewed-on: https://gerrit.instructure.com/25458
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-11-05 23:04:56 +00:00
..
api/v1 convert quiz groups to json api format, and add destroy to api on quiz groups 2013-11-05 17:37:33 +00:00
app_center adding support for edu-apps version 2 2013-10-17 16:05:23 +00:00
auditors start/end times for authentications audit log API 2013-07-21 21:07:11 +00:00
basic_lti unit tests for lit outcomes replace result 2013-10-01 21:19:51 +00:00
bookmarked_collection normalize group sorting, add SimpleBookmarker for common case 2013-07-12 23:09:50 +00:00
canvas update cassandra gem to enable support for 1.2/2.0 2013-10-29 22:06:51 +00:00
cc retain rubric criterion ignore_for_scoring attribute 2013-10-16 18:11:22 +00:00
data_fixup undelete outcome alignments that were erroneously deleted 2013-10-30 20:55:09 +00:00
event_stream log event stream failure counts to statsd 2013-10-17 14:53:48 +00:00
ext remove 1.8 compatibility shims 2013-05-03 01:43:52 +00:00
handlebars updated ember to 1.0.0 2013-09-05 16:46:33 +00:00
i18n make sure LOCALES are respected in i18n:generate_js 2013-08-16 19:59:11 +00:00
i18n_extraction better i18n wrapper inference 2013-05-15 15:25:40 +00:00
incoming_mail add timeouts to incoming message processor 2013-09-25 16:47:02 +00:00
kaltura added timeout to Kaltura::ClientV3 .sendRequest 2013-10-17 16:46:18 +00:00
messageable_user avoid unnecessary sql join when possible 2013-09-12 22:27:21 +00:00
quiz_regrading correctly calculate number of questions affected by multiple regrades 2013-11-04 15:00:51 +00:00
reporting remove last_activity from CountsReport 2013-07-05 21:41:31 +00:00
sis avoid excessive update-cached-due-date callbacks 2013-10-16 21:04:03 +00:00
stubs use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
tasks move compiled coffeescript specs to specs/javascipts/compiled 2013-11-01 21:45:20 +00:00
action_controller_test_process.rb require appropriate file for testing uploads 2013-10-29 19:02:55 +00:00
api.rb use Oj for parsing and serializing json requests/responses 2013-11-05 23:04:56 +00:00
api_route_set.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
api_routes.rb integrate fake_rails3_routes 2013-06-26 21:22:20 +00:00
asset_signature.rb Better signatures for message redirects 2012-12-13 12:12:58 -07:00
assignment_override_applicator.rb cheap hack to skip overriding assignments 2013-07-26 21:43:01 +00:00
attr_config.rb EventStream abstraction 2013-04-19 19:05:14 +00:00
authentication_methods.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
auto_handle.rb switch to ruby stdlib SecureRandom 2013-03-28 20:49:31 +00:00
basic_lti.rb add lti variable substitution support 2013-06-07 15:49:47 +00:00
bookmarked_collection.rb normalize group sorting, add SimpleBookmarker for common case 2013-07-12 23:09:50 +00:00
browser.rb don't warn browsers we don't recognize, fixes CNVS-4754 2013-03-20 22:16:16 +00:00
canvas.rb don't shell out to ps in specs 2013-10-30 20:56:35 +00:00
canvas_logger.rb fix CanvasLogger for rails 3.1+ 2013-04-01 18:41:20 +00:00
canvas_time.rb make fancy midnight work for assignment overrides 2013-03-07 15:53:06 -07:00
cc.rb add calendar events to export/import 2011-04-26 12:28:31 -06:00
color.rb Initial commit. 2011-01-31 18:57:29 -07:00
content_zipper.rb require appropriate file for testing uploads 2013-10-29 19:02:55 +00:00
copy_authorized_links.rb Initial commit. 2011-01-31 18:57:29 -07:00
custom_validations.rb API for adding files by URL 2012-08-15 16:38:50 -06:00
cuty_capt.rb require appropriate file for testing uploads 2013-10-29 19:02:55 +00:00
dates_overridable.rb clean up sorting all over 2013-10-02 21:38:08 +00:00
delicious_diigo.rb fix cert verification in delicious calls 2011-11-18 09:12:03 -07:00
due_date_cacher.rb avoid excessive update-cached-due-date callbacks 2013-10-16 21:04:03 +00:00
ember_bundle.rb add ember-data 2013-11-05 16:59:36 +00:00
enrollments_from_user_list.rb avoid excessive update-cached-due-date callbacks 2013-10-16 21:04:03 +00:00
eportfolio_page.rb arel-ify lib 2013-04-01 19:12:22 +00:00
event_stream.rb add setting for event stream cql read consistency 2013-10-14 21:40:49 +00:00
external_feed_aggregator.rb remove import and external_feed_id from calendar_events. 2013-04-22 22:19:00 +00:00
external_statuses.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
facebook.rb replace retired facebook dashboard api with requests api 2013-10-24 21:27:25 +00:00
fake_rails3_generators.rb fake rails3 generator for simply versioned 2013-10-10 16:09:12 +00:00
file_in_context.rb require appropriate file for testing uploads 2013-10-29 19:02:55 +00:00
file_splitter.rb Initial commit. 2011-01-31 18:57:29 -07:00
google_doc_entry.rb support for lazy loading google docs (backend) 2013-02-20 15:30:59 -07:00
google_docs.rb fixed issue where google doc collaboration links are broken 2013-03-12 15:36:42 -06:00
grade_calculator.rb only select necessary columns for gradecalculator 2013-06-06 20:46:35 +00:00
gradebook_csv_parser.rb remove 1.8 compatibility shims 2013-05-03 01:43:52 +00:00
gradebook_importer.rb replace to_json overrides with as_json overrides 2013-08-29 22:39:32 +00:00
has_content_tags.rb show unlock date for files and pages in locked modules 2013-08-02 18:19:45 +00:00
host_url.rb spec: fix specs with a plugin that overrides HostUrl.file_host_with_shard 2012-11-12 15:50:46 -07:00
i18n_import.rb switch out i18n backend, closes CNVS-5938 2013-06-06 18:11:28 +00:00
i18n_time_zone.rb localize Profile 2011-06-24 09:32:53 -06:00
imported_html_converter.rb add timeout for bulk media upload on import 2013-08-23 19:11:27 +00:00
json_token.rb JSONToken helper module 2013-01-18 09:49:28 -07:00
kaltura.rb set a .csv file extension when using kaltura bulk api 2013-02-16 08:40:21 -07:00
learning_outcome_context.rb Nested outcomes UI, closes #9158 2012-10-25 11:03:21 -06:00
linked_in.rb don't cache twitter and linked_in settings process-wide 2012-05-25 10:13:03 -06:00
locale_selection.rb tweak tie-breaking logic for Accept-Language header 2013-09-17 21:56:36 +00:00
logging_filter.rb fix logging parameter filtering in rails 3.1+ 2013-04-01 18:41:08 +00:00
message_dispatcher.rb don't dispatch cancelled messages, fixes #7397 2012-02-24 12:21:21 -07:00
message_scrubber.rb remove delayed_messages older than 90 days. 2013-10-30 19:15:28 +00:00
messageable_user.rb proper handling of cross-shard admin visibility 2013-06-21 20:40:00 +00:00
model_cache.rb fixes for ruby 1.9.3 2012-05-12 14:34:23 -06:00
multipart.rb spec: fix multipart form builder StringIO filename in 1.8 2013-02-14 12:34:48 -07:00
mutable.rb support using a scope as a condition 2013-10-30 20:02:30 +00:00
nil_store.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
notification_message_creator.rb cancel messages against the correct shard 2013-07-31 09:38:33 -06:00
paginated_collection.rb bookmarked pagination, including multi-shard 2013-01-22 09:41:18 -07:00
permissions.rb allow registering new permissions in plugins 2012-03-02 09:38:06 -07:00
progress_runner.rb add a batch_update method to conversations api 2013-02-14 09:36:36 -07:00
quiz_question_data_fixer.rb quiz questions now soft-delete 2013-09-18 20:15:46 +00:00
quiz_question_link_migrator.rb don't die if a file or question is missing 2011-11-22 17:36:40 -07:00
quiz_regrading.rb add the ability to regrade a quiz 2013-08-19 17:29:26 +00:00
quiz_submission_zipper.rb correctly calculate number of questions affected by multiple regrades 2013-11-04 15:00:51 +00:00
reply_to_address.rb add multiple reply-to support to outgoing mail. 2013-02-22 14:02:27 -07:00
request_context_generator.rb set a header with the session id (for logging purposes) 2012-07-13 16:12:33 -06:00
rubric_context.rb preserve account-level rubric associations on course copy 2013-06-19 19:23:48 +00:00
scribd_api.rb fix off by one error in scribd delete method 2013-10-31 01:19:21 +00:00
search_term_helper.rb add search_term to files, modules, and module item apis 2013-08-02 20:12:04 +00:00
send_to_inbox.rb class_inheritable_accessor -> class_attribute 2013-10-29 17:53:35 +00:00
send_to_stream.rb class_inheritable_accessor -> class_attribute 2013-10-29 17:53:35 +00:00
simple_stats.rb quiz item analysis generation, closes CNVS-3421 2013-04-23 15:50:36 +00:00
simple_tags.rb add "none" scope 2013-10-29 20:25:45 +00:00
sis.rb remove unnecessary lib/sis requires 2013-04-02 15:58:29 +00:00
skip_callback.rb refactor sticky sis fields 2011-09-27 16:34:37 -06:00
sort_first.rb clean up sorting all over 2013-10-02 21:38:08 +00:00
sort_last.rb clean up sorting all over 2013-10-02 21:38:08 +00:00
sorts_assignments.rb make "Upcoming Assignments" lists vdd aware 2013-02-06 13:21:58 -07:00
ssl_common.rb support funky characters in username/passwords for http url parsing 2011-09-08 14:21:50 -06:00
stats.rb fixed calculation of variance and standard deviation 2013-05-09 18:50:05 +00:00
sticky_sis_fields.rb [#5773] Ruby 1.9.3 spec fixes 2012-10-25 09:34:28 -06:00
submission_list.rb clean up sorting all over 2013-10-02 21:38:08 +00:00
summary_message_consolidator.rb switch to Shackles gem 2013-04-17 16:25:06 +00:00
syslog_wrapper.rb log context when using local rails buffered logger 2011-07-25 13:25:18 -06:00
text_helper.rb stop adding line breaks to html announcement notifications 2013-10-30 17:08:25 +00:00
time_helper.rb calendar events api: fix date boundary handling 2013-02-06 13:49:45 -07:00
time_zone_helper.rb return time zone in user profile api 2013-07-25 16:46:32 +00:00
tinychat.rb remove deprecated rails constant usage 2013-03-11 12:14:08 -06:00
tmail_parser.rb Initial commit. 2011-01-31 18:57:29 -07:00
tour.rb added front-end to tour guide 2013-07-18 21:55:05 +00:00
turnitin.rb configurable turnitin api endpoint 2013-07-08 20:25:41 +00:00
twitter.rb update twitter api to v1.1. 2013-03-01 15:09:02 -07:00
twitter_messenger.rb twitter link sending to correct url 2013-04-26 16:02:03 +00:00
unzip_attachment.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
user_content.rb copy links to wiki pages that start with numbers correctly 2013-03-15 14:30:58 -06:00
user_list.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
user_merge.rb clear temporary_invitations cache after user merge 2013-11-05 19:39:12 +00:00
user_search.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
uuid_singleton.rb Initial commit. 2011-01-31 18:57:29 -07:00
workflow.rb change class_inheritable_accessor and write_inheritable_hash to class_attribute 2013-04-01 18:41:30 +00:00
zip_extractor.rb Initial commit. 2011-01-31 18:57:29 -07:00