Commit d4f7615d authored by Stan Hu's avatar Stan Hu

Use Oj for faster JSON parsing

parent 8e4c5b26
......@@ -3,6 +3,7 @@ source 'https://rubygems.org'
gem 'dotenv', '~> 2.0.2'
gem 'mrkt', '~> 0.6.0'
gem 'full-name-splitter', '~> 0.1.2'
gem 'oj', '~> 2.17'
gem 'sentry-raven', '~> 0.15'
gem 'sinatra', '~> 1.4.6', require: 'sinatra/base'
gem 'unicorn'
......@@ -11,6 +11,7 @@ GEM
mrkt (0.6.1)
faraday_middleware (~> 0.9.1)
multipart-post (2.0.0)
oj (2.17.5)
rack (1.6.4)
rack-protection (1.5.3)
rack
......@@ -34,9 +35,10 @@ DEPENDENCIES
dotenv (~> 2.0.2)
full-name-splitter (~> 0.1.2)
mrkt (~> 0.6.0)
oj (~> 2.17)
sentry-raven (~> 0.15)
sinatra (~> 1.4.6)
unicorn
BUNDLED WITH
1.11.2
1.13.2
require 'json'
require 'oj'
require './lib/marketo_client'
require './lib/user'
......@@ -19,8 +19,8 @@ class MarketoTools < Sinatra::Base
# See http://gitlab.com/help/system_hooks/system_hooks
post '/system_hook' do
begin
params = JSON.parse(request.body.read)
rescue JSON::ParserError
params = Oj.load(request.body.read)
rescue Oj::ParseError
params = {}
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment