Commit 445dba15 authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'use-oj' into 'master'

Use Oj for faster JSON parsing

See merge request !5
parents 8e4c5b26 d4f7615d
...@@ -3,6 +3,7 @@ source 'https://rubygems.org' ...@@ -3,6 +3,7 @@ source 'https://rubygems.org'
gem 'dotenv', '~> 2.0.2' gem 'dotenv', '~> 2.0.2'
gem 'mrkt', '~> 0.6.0' gem 'mrkt', '~> 0.6.0'
gem 'full-name-splitter', '~> 0.1.2' gem 'full-name-splitter', '~> 0.1.2'
gem 'oj', '~> 2.17'
gem 'sentry-raven', '~> 0.15' gem 'sentry-raven', '~> 0.15'
gem 'sinatra', '~> 1.4.6', require: 'sinatra/base' gem 'sinatra', '~> 1.4.6', require: 'sinatra/base'
gem 'unicorn' gem 'unicorn'
...@@ -11,6 +11,7 @@ GEM ...@@ -11,6 +11,7 @@ GEM
mrkt (0.6.1) mrkt (0.6.1)
faraday_middleware (~> 0.9.1) faraday_middleware (~> 0.9.1)
multipart-post (2.0.0) multipart-post (2.0.0)
oj (2.17.5)
rack (1.6.4) rack (1.6.4)
rack-protection (1.5.3) rack-protection (1.5.3)
rack rack
...@@ -34,9 +35,10 @@ DEPENDENCIES ...@@ -34,9 +35,10 @@ DEPENDENCIES
dotenv (~> 2.0.2) dotenv (~> 2.0.2)
full-name-splitter (~> 0.1.2) full-name-splitter (~> 0.1.2)
mrkt (~> 0.6.0) mrkt (~> 0.6.0)
oj (~> 2.17)
sentry-raven (~> 0.15) sentry-raven (~> 0.15)
sinatra (~> 1.4.6) sinatra (~> 1.4.6)
unicorn unicorn
BUNDLED WITH BUNDLED WITH
1.11.2 1.13.2
require 'json' require 'oj'
require './lib/marketo_client' require './lib/marketo_client'
require './lib/user' require './lib/user'
...@@ -19,8 +19,8 @@ class MarketoTools < Sinatra::Base ...@@ -19,8 +19,8 @@ class MarketoTools < Sinatra::Base
# See http://gitlab.com/help/system_hooks/system_hooks # See http://gitlab.com/help/system_hooks/system_hooks
post '/system_hook' do post '/system_hook' do
begin begin
params = JSON.parse(request.body.read) params = Oj.load(request.body.read)
rescue JSON::ParserError rescue Oj::ParseError
params = {} params = {}
end 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