Permalink
Browse files

Drop caching

  • Loading branch information...
1 parent 11f3ddb commit e5cb17d0b9b33ce6959f146d3e4e3e49dd736969 @hakanensari committed Jan 10, 2017
Showing with 2 additions and 40 deletions.
  1. +0 −2 .travis.yml
  2. +1 −1 Dockerfile
  3. +0 −2 Gemfile
  4. +0 −5 Gemfile.lock
  5. +0 −4 docker-compose.yml
  6. +1 −11 lib/api.rb
  7. +0 −11 spec/api_spec.rb
  8. +0 −4 spec/edge_cases_spec.rb
View
@@ -2,6 +2,4 @@ before_script:
- psql -c 'create database fixer_test;' -U postgres
rvm:
- 2.4.0
-services:
- - memcached
sudo: false
View
@@ -6,4 +6,4 @@ ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install --without development test
ADD . /app
-CMD ./wait-for-it.sh db:5432 -s -- wait-for-it.sh memcache:11211 -s -- unicorn -c /app/config/unicorn.rb
+CMD ./wait-for-it.sh db:5432 -s -- unicorn -c /app/config/unicorn.rb
View
@@ -3,12 +3,10 @@ source 'http://rubygems.org'
ruby '2.4.0'
-gem 'dalli'
gem 'fixer'
gem 'kgio'
gem 'newrelic_rpm'
gem 'oj'
-gem 'rack-cache'
gem 'rack-cors'
gem 'rake'
gem 'sequel_pg'
View
@@ -3,7 +3,6 @@ GEM
specs:
ast (2.3.0)
coderay (1.1.1)
- dalli (2.7.6)
fixer (0.7.0)
kgio (2.11.0)
method_source (0.8.2)
@@ -21,8 +20,6 @@ GEM
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.5)
- rack-cache (1.6.1)
- rack (>= 0.4)
rack-cors (0.4.0)
rack-protection (1.5.3)
rack
@@ -59,15 +56,13 @@ PLATFORMS
ruby
DEPENDENCIES
- dalli
fixer
kgio
minitest
minitest-around
newrelic_rpm
oj
pry
- rack-cache
rack-cors
rack-test
rake
View
@@ -2,8 +2,6 @@ version: '2'
services:
db:
image: postgres
- memcache:
- image: memcached
web:
build: .
volumes:
@@ -13,7 +11,5 @@ services:
environment:
RACK_ENV: production
DATABASE_URL: postgres://postgres@db/postgres
- MEMCACHE_SERVERS: memcache
links:
- db
- - memcache
View
@@ -1,16 +1,9 @@
# frozen_string_literal: true
-require 'dalli'
require 'oj'
require 'sinatra'
-require 'rack/cache'
require 'rack/cors'
require 'quote'
-use Rack::Cache,
- verbose: true,
- metastore: "memcached://#{ENV['MEMCACHE_SERVERS']}/meta",
- entitystore: "memcached://#{ENV['MEMCACHE_SERVERS']}/body"
-
use Rack::Cors do
allow do
origins '*'
@@ -34,14 +27,11 @@ def quote
def quote_attributes
@quote_attributes ||= quote.attributes.tap do |data|
+ symbols = params.values_at('symbols', 'to').compact.first
data[:rates].keep_if { |k, _| symbols.include?(k) } if symbols
end
end
- def symbols
- @symbols ||= params.values_at('symbols', 'to').compact.first
- end
-
def jsonp(data)
json = encode_json(data)
callback = params.delete('callback')
View
@@ -10,10 +10,6 @@
let(:json) { Oj.load(last_response.body) }
let(:headers) { last_response.headers }
- before do
- Dalli::Client.new.flush
- end
-
it 'describes itself' do
get '/'
last_response.must_be :ok?
@@ -101,11 +97,4 @@
get '/latest?from=GBP&to=USD&amount=100'
json['rates']['USD'].must_be :>, 100
end
-
- it 'sets Content-Type header to JSON when caching' do
- 2.times do
- get '/latest'
- last_response.headers['Content-Type'].must_equal 'application/json'
- end
- end
end
@@ -9,10 +9,6 @@
let(:app) { Sinatra::Application }
let(:json) { Oj.load(last_response.body) }
- before do
- Dalli::Client.new.flush
- end
-
it 'handles unfound pages' do
get '/foo'
last_response.status.must_equal 404

0 comments on commit e5cb17d

Please sign in to comment.