After upgrading the redis version in order to upgrade to sidekiq version 7. Whenever I try to write to the cache it returns false. But sidekiq works correctly.
Sidekiq 7.0.0
redis gem 5.0.5
redis 7.0.5
3.1.1 :003 > Rails.cache
=> #<ActiveSupport::Cache::RedisCacheStore options={:namespace=>nil, :compress=>true, :compress_threshold=>1024, :expires_in=>nil, :race_condition_ttl=>nil} redis=#<Redis client v5.0.5 for redis://127.0.0.1:6379/0>>
3.1.1 :005 > Rails.cache.write 'test', 'test'
=> false
EDIT:
Solved.The problem was in the new redis.conf file that was generated when upgrading.
Related
I'm using the rgeo gem which gives me troubles on the production server, although it works on my local machine.
This outputs are same on both local MacOS and Ubuntu 16.04 production machine:
psql --version -> (PostgreSQL) 9.6.15
geos-config --version -> 3.7.1
SELECT postgis_full_version(); returns:
POSTGIS="2.3.3 r15473" GEOS="3.7.1-CAPI-1.11.1 27a5e771" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.3" LIBJSON="0.11.99" TOPOLOGY RASTER
But in rails c the production machine returns:
RGeo::Geos.supported? => false
although irb returns RGeo::Geos.supported? => true
Any advice is very much appreciated.
For others with this problem, spring stop and restart rails console could be enough if you installed everything correctly
I have a memcached container and a Rails App.
If a I have loop doing this:
100.times do
puts Rails.cache.read('yes')
sleep(0.5)
end
And I open the Rails console to write into the cache
Rails.cache.write('yes', 'value')
I will still have a nil value in my put.
But if a write/read from the console or directly from the app, it works well.
What I am doing wrong ? Or what did I miss ?
Thanks in advance
Here's the configuration of memcached in my production.rb file
config.cache_store = :mem_cache_store, ENV['MEMCACHED_HOST']
More info:
If I write into the cache and launch the app, it will catch the value.
Both Rails app and Memcached are Docker containers.
Rails version: 5.1.5
Ruby version: 2.5.0
Gem Dalli version: 2.7.8
Memcached version: 1.5.10
Docker version: 18.03.1
2 servers (same gems, exactly same ruby version 2.2.2p95 installed)
Development
Loading development environment (Rails 4.0.13)
[1] pry(main)> (1/3).class
=> Fixnum
[2] pry(main)> (1/3)
=> 0
[3] pry(main)>
Production
Loading production environment (Rails 4.0.13)
2.2.2 :001 > (1/3).class
=> Rational
2.2.2 :002 > (1/3)
=> (1/3)
2.2.2 :003 >
wth ? The only difference between the two environments is that one uses rvm (production) the other not
Ok the issue is due to a dependency gem using mathn module, trying now to figure out which gem is :)
I have upgraded my rails app from rails 2x to 3.2.3. But facing a weird issue.
Any changes I do in controller and model are not reflecting until I restart my rails server.
Caching is disabled in my development.rb as
config.cache_classes = false
config.action_controller.perform_caching = false
But it doesn't work. I even tried updating my rails version to 3.2.5
My application configuration is
Ruby version : ruby 1.9.3p194 with RVM
Rails version : 3.2.3
Application server: webrick
Webserver: Apache
Thanks in advance
In the first few rails app I setup for small apps to learn I used
RAILS_ENV=production rake db:setup
and it created the (mysql) tables on myapp_production
But this time I am not able to populate development or test DB. It just writes to production, also the app running on the Mongrel server writes to production DB but says it'S development environment on startup:
$ rails server
WARNING: This version of mysql2 (0.3.6) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
I don't use rvm here (tried on another box and guess I like it)
I am not sure how to troubeshoot this. And there is no error message.
You use old Rails version. mysql2 gem as of 0.3.0 do not support rails 3.0 and earlier. So you need either update rails to 3.1.x or higher or use gem "mysql2", "~> 0.2.7" in your Gemfile. See mysql2 gem page, search for "3.0" in your browser.
Maybe that's the reason.