Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow

Redis::TimeoutError: Connection timed out Error -Rails cache

$
0
0

We are using redis(Elasticache) as our cache store.We are experiencing crashes in our app due to redis connection timeout.We have three app servers and use phusion passenger.At the time of crashes there are about 200 active connections.

/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:55:in `rescue in _read_from_socket'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:48:in `_read_from_socket'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:41:in `gets'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:273:in `read'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:248:in `block in read'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:236:in `io'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:247:in `read'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `block in call'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:217:in `block (2 levels) in process'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:353:in `ensure_connected'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:207:in `block in process'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:292:in `logging'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:206:in `process'/home/chillr/deploy/chillr-api/shared/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `call'

SlOWLOG commands

1) 1) (integer) 68673752) (integer) 14867015073) (integer) 620084) 1) "eval"   2) "for i, name in ipairs(redis.call('KEYS', 'cache:user_transaction_logs:*:9008245678')) do redis.call('DEL', name); end"   3) "0" 2) 1) (integer) 6867374    2) (integer) 1486701507    3) (integer) 61989    4) 1) "KEYS"       2) "cache:user_transaction_logs:*:9008245678" 3) 1) (integer) 6867373    2) (integer) 1486701507    3) (integer) 61026    4) 1) "eval"       2) "for i, name in ipairs(redis.call('KEYS', 'cache:user_transaction_logs:*:8888662136')) do redis.call('DEL', name); end"       3) "0" 4) 1) (integer) 6867372    2) (integer) 1486701507    3) (integer) 61006    4) 1) "KEYS"       2) "cache:user_transaction_logs:*:8888662136" 5) 1) (integer) 6867371    2) (integer) 1486701507    3) (integer) 63070    4) 1) "eval"

We use

  • Elasticache cache.
  • t2.medium Phusion Passenger

No of connections at time of Crash 175..200

GEM redis (3.2.1) redis-rails (5.0.1)

What could be done


Sidekiq doesnt connect to Heroku Redis for Data. RedisClient::CannotConnectError

$
0
0

I am working on a Rails project deployed on Heroku with two add-ons (Heroku Scheduler and Heroku Redis for Data) that are supposed to launch jobs at a certain time.

I don't know exactly when this issue started occurring, but we have noticed bugs raised in our bug management app. The reported bugs are:

RedisClient::CannotConnectError name_of_the_rake_task getaddrinfo: Name or service not known

We have managed to understand that this error message appears to be similar to an unknown hostname error or something indicating a lack of information for connecting the Scheduler to Redis.

These errors occur every time the job should be launched; sometimes the job is launched correctly, and sometimes it is not. Even after deleting jobs from Heroku Scheduler, the errors persist.

The problem doesn't seem to be coming from the performance or the plan used with heroku redis add-on, we have access to 100mb/month, we use at max 2mb.

I use:

ruby '3.1.0'gem 'rails', '7.0.4'gem 'redis', '5.0.6'redis-client (>= 0.9.0)

Version of Heroku Redis for Data: 6.2.14Plan: premium-1

We try to rebuild configuration in our rails app by rewrite, as the heroku doc suggest the files:

  • initializers/redis.rb
$redis = Redis.new(url: ENV["REDIS_URL"], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE })
  • initializers/sikekiq.rb
# $redis = Redis.newSidekiq.configure_server do |config|  config.redis = {    url: ENV["REDIS_URL"],    ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }  }endSidekiq.configure_client do |config|  config.redis = {      url: ENV["REDIS_URL"],      ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }  }end

We deleted the environment variable configuration for 'REDIS_URL' in our Heroku admin panel, allowing Heroku to manage this element automatically.

Also, as mention in this doc we set REDIS_PROVIDER to REDIS_URL in heroku.

unable to access global redis in a Sidekiq job via sidekiq-scheduler

$
0
0

We are thinking of moving from resque-scheduler to sidekiq-scheduler. We have a reference to a global $redis instance but in our job, we are not able to access it, like the following.

require 'sidekiq-scheduler'class HelloWorld  include Sidekiq::Worker  def perform    $redis.incr(Time.new.strftime("hello-world-%Y-%m-%d"))    puts 'Hello world'  endend

Our $redis is instantiated in config/initializers/00_redis.rb like

$redis = Redis.new

which I can access from a rails console. Any idea what I'm doing wrong?

Sidekiq Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) on docker-compose

$
0
0

I'm trying to run sidekiq worker with Rails. When I try to docker-compose up worker I get the following error:

worker_1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:332:in `rescue in establish_connection'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:318:in `establish_connection'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:94:in `block in connect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:280:in `with_reconnect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:93:in `connect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:351:in `ensure_connected'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:208:in `block in process'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:293:in `logging'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:207:in `process'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:113:in `call'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:211:in `block in info'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `block in synchronize'worker_1 | /usr/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `synchronize'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:210:in `info'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:71:in `block in run'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq.rb:84:in `block in redis'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64:in `block (2 levels) in with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `handle_interrupt'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `block in with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `handle_interrupt'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq.rb:81:in `redis'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:68:in `run'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/bin/sidekiq:13:in `<top (required)>'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `load'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>'nyvur_worker_1 exited with code 1

Here's my docker-compose file:

web: &app_base  build: .  ports:    - "80:80"  volumes:    - .:/Nyvur  command: /usr/bin/start_server.sh  links:    - postgres    - mongo    - redis  environment: &app_environment    SIDEKIQ_CONCURRENCY: 50    SIDEKIQ_TIMEOUT: 10    ENABLE_DEBUG_SERVER: true    RACK_ENV: production    RAILS_ENV: productionworker:  build: .  volumes:    - .:/Nyvur  ports: []  links:    - postgres    - mongo    - redis  command: bundle exec sidekiq -c 50postgres:  image: postgres:9.1  ports:    - "5432:5432"  environment:    LC_ALL: C.UTF-8    POSTGRES_DB: Nyvur_production    POSTGRES_USER: postgres    POSTGRES_PASSWORD: 3x1mpl3mongo:  image: mongo:3.0.7  ports:    - "27017:27017"redis:  image: redis  ports:    - "6379:6379"

My Dockerfile:

FROM phusion/passenger-customizableMAINTAINER VodkaMD <support@nyvur.com>ENV RACK_ENV="production" RAILS_ENV="production"SECRET_KEY_BASE="e09afa8b753cb175bcef7eb5f737accd02a4c16d9b6e5d475943605abd4277cdf47c488812d21d9c7117efd489d876f34be52f7ef7e88b21759a079339b198ce"ENV HOME /rootCMD ["/sbin/my_init"]RUN /pd_build/utilities.shRUN /pd_build/ruby2.2.shRUN /pd_build/python.shRUN /pd_build/nodejs.shRUN /pd_build/redis.shRUN /pd_build/memcached.shRUN apt-get update && apt-get install -y vim nano dialog net-tools build-essential wget libpq-dev gitRUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*# RUN mkdir /etc/nginx/ssl# RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crtRUN rm -f /etc/service/nginx/downRUN rm -f /etc/service/redis/downRUN rm -f /etc/service/sshd/downRUN rm -f /etc/service/memcached/downWORKDIR /tmpADD Gemfile /tmp/ADD Gemfile.lock /tmp/RUN mkdir /home/app/NyvurADD . /home/app/NyvurRUN chown -R app:app /home/app/NyvurWORKDIR /home/app/NyvurRUN bundle install --deploymentRUN bundle exec rake assets:precompileRUN rm /etc/nginx/sites-enabled/defaultCOPY config/nginx/nginx_nyvur.conf /etc/nginx/sites-enabled/nginx_nyvur.confADD config/nginx/postgres-env.conf /etc/nginx/main.d/postgres-env.confADD config/nginx/rails-env.conf /etc/nginx/main.d/rails-env.confADD config/nginx/start_server.sh /usr/bin/start_server.shRUN chmod +x /usr/bin/start_server.shRUN mkdir -p /home/app/Nyvur/tmp/pidsRUN mkdir -p /home/app/Nyvur/tmp/socketsRUN mkdir -p /home/app/Nyvur/logRUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*EXPOSE 80 443 9292

I've tried different configurations, I've checked other builds, but the problem still persists, So far, Sidekiq runs well outside of Docker.

How can i generate consecutive codes with redis?

$
0
0

i would like to generate a consecutive codes, like PR00001, EC00002, TG00003 and so on, the first two letters have to be from the name and the last name.

my pseudocode is

recovery the number from database 00001, add +1 then i will get 00002 and concat with the lettersPR+00002 

but my team lead suggested to use redis to generate that code, to me is simple why should i use redis to generate that code?

how should i implement that code using redis?

Use Redis as primary database in Rails app

$
0
0

Hello I am newbie to Redis. I am trying to use Redis as my primary database instead of sqlite as provided by default with Rails. I tried enough googling but could not find relevant stuff. How to achieve this? Or if iam wrong whether can we use Redis as primary database in Rails application?

Thanks

Docker compose for rails application

$
0
0

I have below docker compose file, and i have few questions regarding it,

version: '3.8'services:  web:    build:      context: ./      dockerfile: Dockerfile    platform: linux/amd64    command: bash -c "rm -f tmp/pids/server.pid && bin/rails s -p 3000 -b '0.0.0.0'"    env_file:      - .env.development    volumes:      - .:/usr/src/app      - bundle:/usr/local/bundle    ports:      - "3000:3000"    environment:      REDIS_HOST: redis      REDIS_URL: redis://redis-server:6379/0      REDIS_PORT: 6379    depends_on:      db:        condition: service_healthy      redis:        condition: service_started  db:    image: postgres:16    ports:      - "5432:5432"    environment:      - POSTGRES_PASSWORD=postgres    volumes:      - pg_data:/var/lib/postgresql/data    healthcheck:      test: pg_isready -U postgres      interval: 2s      timeout: 5s      retries: 30  redis:    image: redis:7.0-alpine    restart: always    volumes:      - redis_data:/data    ports:      - 6379  sidekiq:    build: .    command: bundle exec sidekiq    depends_on:      - redis  rabbitmq:    image: "rabbitmq:latest"    ports:      - "5672:5672"  # sneakers:  #   build: .  #   command: "bundle exec rails sneakers:run"  #   depends_on:  #     - web  #     - rabbitmq  #     - redisvolumes:  pg_data:  redis_data:  bundle:

this is the database.yml file

default: &default  adapter: postgresql  encoding: unicode  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>development:<<: *default  database: <%= ENV['DB_NAME'] %>  username: <%= ENV['DB_USERNAME'] %>  password: <%= ENV['DB_PASSWORD'] %>  host: <%= ENV['DB_HOST'] %>  port: <%= ENV['DB_PORT'] %>test:<<: *default  database: <%= ENV['DB_NAME'] %>  username: <%= ENV['DB_USERNAME'] %>  password: <%= ENV['DB_PASSWORD'] %>  host: <%= ENV['DB_HOST'] %>  port: <%= ENV['DB_PORT'] %>cd_dev:<<: *default  database: <%= ENV['dbClusterIdentifier'] %>  username: <%= ENV['username'] %>  password: <%= ENV['password'] %>  host: <%= ENV['host'] %>  port: <%= ENV['port'] %>cd_qa:<<: *default  database: <%= ENV['dbClusterIdentifier'] %>  username: <%= ENV['username'] %>  password: <%= ENV['password'] %>  host: <%= ENV['host'] %>  port: <%= ENV['port'] %>cd_staging:<<: *default  database: <%= ENV['dbClusterIdentifier'] %>  username: <%= ENV['username'] %>  password: <%= ENV['password'] %>  host: <%= ENV['host'] %>  port: <%= ENV['port'] %>cd_production:<<: *default  database: <%= ENV['dbClusterIdentifier'] %>  username: <%= ENV['username'] %>  password: <%= ENV['password'] %>  host: <%= ENV['host'] %>  port: <%= ENV['port'] %>

I am getting below error in logs

cd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:46.265 # Can't handle RDB format version 11cd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:46.266 # Fatal error loading the DB: Invalid argument. Exiting.cd-notification-common-service-redis-1     | 1:C 13 Feb 2024 21:29:48.167 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oocd-notification-common-service-redis-1     | 1:C 13 Feb 2024 21:29:48.167 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=1, just startedcd-notification-common-service-redis-1     | 1:C 13 Feb 2024 21:29:48.167 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.confcd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:48.168 * monotonic clock: POSIX clock_gettimecd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:48.174 * Running mode=standalone, port=6379.cd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:48.174 # Server initializedcd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:48.176 # Can't handle RDB format version 11cd-notification-common-service-redis-1     | 1:M 13 Feb 2024 21:29:48.176 # Fatal error loading the DB: Invalid argument. Exiting.cd-notification-common-service-redis-1 exited with code 1

I have a few questions

  1. I am using aws secret store which is working fine when I was using a single docker file, do I need to define the secrets again in docker-compose? Suppose i have lots of env in database yml. it is loading from the secret manager, do I again need to define it in docker-compose?

  2. The Redis is in a different container and the Rails app is in a different container, I kept getting the error Cannot assign requested address - connect(2) for [::1]:6379 (Errno::EADDRNOTAVAIL) , how to use redis container in a rails app?

  3. I am using rabbitmq and for workers, I am using sneakers gem locally, how can I add it in docker-compose?

  4. I am gonna use this in the dev environment. do I need to specify anything related to env?

Redis key expiry hook/notifications in rails

$
0
0

I need to call a (callback)method once a Redis key got expired. Does redis(ruby gem) provide any notification mechanism or callback registration?

Any assistance will be appreciated.


Redis raises "NOAUTH Authentication required" error but there is no password setting

$
0
0

I got error NOAUTH Authentication required when I connect to Redis server via command: redis-cli and run ping to check if Redis is working.

I found answer for NOAUTH Authentication required error which describes that this error only happens when Redis is set a password, but I checked Redis config file at etc/redis/redis.conf and there is no password setting.

Redis config

Does anyone know that if there are other settings which can cause this error? Thanks for any help.

p/s: I am using Ruby on Rails web framework, Redis database is used for Sidekiq.

Edited: Redis version is 2.8.4. Server is hosted on AWS.

Currently, I decided to set a password for Redis server so that it can not be set password when it is running.

(When Redis server is restarted, it will work normal. You can run sudo service redis-server restart to restart Redis server.)

Foreman terminates immediately

$
0
0

I recently installed OSX and Ubuntu on different computers. I then attempted to install redis and foreman for both OS's. Both errors threw no flags, and seemed to execute successfully. However, whenever I go to start foreman with foreman start, I run into the below issue on both computers:

23:48:35 web.1    | started with pid 131623:48:35 redis.1  | started with pid 131723:48:35 worker.1 | started with pid 131823:48:35 redis.1  | [1317] 11 Jun 23:48:35.180 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 * Increased maximum number of open files to 10032 (it was originally set to 256).23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 # Creating Server TCP listening socket *:6379: bind: Address already in use23:48:35 redis.1  | exited with code 123:48:35 system   | sending SIGTERM to all processes23:48:35 worker.1 | terminated by SIGTERM23:48:35 web.1    | terminated by SIGTERM

For some reason, it seems like a path issue to me because it seems like Redis or Foreman cannot find the files they need to use to successfully execute, but I'm not exactly sure.

On OSX I used gem install foreman and Brew install Redis .

On Ubuntu I used the following:

Redis:

$ cd ~$ wget http://download.redis.io/redis-stable.tar.gz$ tar xvzf redis-stable.tar.gz$ cd redis-stable$ make$ make test 

Foreman:

$ gem install foreman

My PATH on OSX is as follows:

/Users/c/.rvm/gems/ruby-2.1.0/bin:/Users/c/.rvm/gems/ruby-2.1.0@global/bin:/Users/c/.rvm/rubies/ruby-2.1.0/bin:/Users/c/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

On Ubuntu, my PATH is:

/usr/local/bin:/usr/lib/postgresql:/usr/lib/postgresql/9.3:/usr/lib/ postgresql/9.3/lib:/usr/lib/postgresql/9.3/bin:/usr/share/doc:/usr/share/doc/postgresql-9.3:/usr/share/postgresql:/usr/share/postgresql/9.3:/usr/share/postgresql/9.3/man:$PATH

Redis-server does seem to execute successfully once, and then it fails with the message:

[1457] 12 Jun 00:02:48.481 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf[1457] 12 Jun 00:02:48.482 * Increased maximum number of open files to 10032 (it was originally set to 256).[1457] 12 Jun 00:02:48.483 # Creating Server TCP listening socket *:6379: bind: Address already in use

Trying $ redis-server stop returns:

[1504] 12 Jun 00:05:56.173 # Fatal error, can't open config file 'stop'

I need help figuring out how to get Foreman and Redis working together so that I can view my local files in the browser at 127.0.0.1

EDIT

Redis does start, but nothing happens when I navigate to localhost:6379. I also tried the suggestion of finding processes. It found

c                751   0.0  0.0  2432768    596 s005  R+    2:03PM   0:00.00 grep redisc                616   0.0  0.0  2469952   1652 s004  S+    2:01PM   0:00.05 redis-server *:6379

Trying to kill the process results in

kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

redis.rb - initialize': no implicit conversion of String into Integer (TypeError) #1277

$
0
0

trying to run websockets using action_cable sidekiq and redis (heroku redis addon).on staging env that has same redis machine im able to run everything smoothly but on production upon trying to connect to websocket: wss://XXXXXX.herokuapp.com/cable i get the next error:/app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:22:in initialize': no implicit conversion of String into Integer (TypeError)`

full trace from heroku logs:

2024-05-12T13:48:46.158810+00:00 app[web.2]: #<Thread:0x0000563a510f8458 /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:150 run> terminated with exception (report_on_exception is true):2024-05-12T13:48:46.158858+00:00 app[web.2]: /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:22:in `initialize': no implicit conversion of String into Integer (TypeError)2024-05-12T13:48:46.158888+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:22:in `initialize'2024-05-12T13:48:46.158889+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:254:in `new'2024-05-12T13:48:46.158890+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:254:in `connect'2024-05-12T13:48:46.158895+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:306:in `connect'2024-05-12T13:48:46.158896+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:385:in `establish_connection'2024-05-12T13:48:46.158900+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:115:in `block in connect'2024-05-12T13:48:46.158901+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:344:in `with_reconnect'2024-05-12T13:48:46.158910+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:114:in `connect'2024-05-12T13:48:46.158910+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:325:in `with_socket_timeout'2024-05-12T13:48:46.158921+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:174:in `call_loop'2024-05-12T13:48:46.158922+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/subscribe.rb:44:in `subscription'2024-05-12T13:48:46.158926+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/subscribe.rb:14:in `subscribe'2024-05-12T13:48:46.158927+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:288:in `_subscription'2024-05-12T13:48:46.158936+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/commands/pubsub.rb:20:in `block in subscribe'2024-05-12T13:48:46.158936+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `block in synchronize'2024-05-12T13:48:46.158937+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.158941+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.158942+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/commands/pubsub.rb:19:in `subscribe'2024-05-12T13:48:46.158953+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:83:in `block in listen'2024-05-12T13:48:46.158954+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:344:in `with_reconnect'2024-05-12T13:48:46.158955+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:95:in `block in with_reconnect'2024-05-12T13:48:46.158956+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `block in synchronize'2024-05-12T13:48:46.158965+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.158965+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.158969+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:94:in `with_reconnect'2024-05-12T13:48:46.158970+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:101:in `without_reconnect'2024-05-12T13:48:46.158980+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:80:in `listen'2024-05-12T13:48:46.158980+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:154:in `block in ensure_listener_running'2024-05-12T13:48:46.188758+00:00 app[web.2]: /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:22:in `initialize': no implicit conversion of String into Integer (TypeError)2024-05-12T13:48:46.188760+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:22:in `initialize'2024-05-12T13:48:46.188771+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:254:in `new'2024-05-12T13:48:46.188771+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:254:in `connect'2024-05-12T13:48:46.188772+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/connection/ruby.rb:306:in `connect'2024-05-12T13:48:46.188774+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:385:in `establish_connection'2024-05-12T13:48:46.188782+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:115:in `block in connect'2024-05-12T13:48:46.188782+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:344:in `with_reconnect'2024-05-12T13:48:46.188783+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:114:in `connect'2024-05-12T13:48:46.188793+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:325:in `with_socket_timeout'2024-05-12T13:48:46.188793+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:174:in `call_loop'2024-05-12T13:48:46.188801+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/subscribe.rb:44:in `subscription'2024-05-12T13:48:46.188801+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/subscribe.rb:14:in `subscribe'2024-05-12T13:48:46.188802+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:288:in `_subscription'2024-05-12T13:48:46.188820+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/commands/pubsub.rb:20:in `block in subscribe'2024-05-12T13:48:46.188820+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `block in synchronize'2024-05-12T13:48:46.188828+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.188828+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.188836+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/commands/pubsub.rb:19:in `subscribe'2024-05-12T13:48:46.188837+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:83:in `block in listen'2024-05-12T13:48:46.188838+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis/client.rb:344:in `with_reconnect'2024-05-12T13:48:46.188847+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:95:in `block in with_reconnect'2024-05-12T13:48:46.188847+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `block in synchronize'2024-05-12T13:48:46.188855+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.188855+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:265:in `synchronize'2024-05-12T13:48:46.188863+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:94:in `with_reconnect'2024-05-12T13:48:46.188863+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/redis-4.8.1/lib/redis.rb:101:in `without_reconnect'2024-05-12T13:48:46.188872+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:80:in `listen'2024-05-12T13:48:46.188872+00:00 app[web.2]: from /app/vendor/bundle/ruby/2.7.0/gems/actioncable-6.1.7.7/lib/action_cable/subscription_adapter/redis.rb:154:in `block in ensure_listener_running'2024-05-12T13:48:46.268851+00:00 app[web.2]: [2] - Worker 0 (PID: 29) booted in 0.0s, phase: 02024-05-12T13:48:46.000000+00:00 app[redis-asymmetrical-47170]: Error accepting a client connection: (null)
#cable.rb:development:  adapter: redis  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>test:  adapter: redis  url: <%= ENV["REDIS_URL"] %>  ssl_params:    verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>staging:  adapter: redis  url: <%= ENV["REDIS_URL"] %>  ssl_params:    verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>production:  adapter: redis  url: <%= ENV["REDIS_URL"] %>  channel_prefix: bw_backend_production  ssl_params:    verify_mode: OpenSSL::SSL::VERIFY_NONE # For debugging SSL issues only
#sidekiq.rb # require 'logtail'ssl_params = {  verify_mode: OpenSSL::SSL::VERIFY_NONE,}Rails.logger.info "Sidekiq SSL params: #{ssl_params.inspect}"puts "Sidekiq SSL params: #{ssl_params.inspect}"Sidekiq.configure_server do |config|  redis_options = {     url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1'),     ssl_params: ssl_params   }  Rails.logger.info "Sidekiq server Redis options: #{redis_options.inspect}"  puts "Sidekiq server Redis options: #{redis_options.inspect}"  config.redis = redis_options  config.logger = Sidekiq::Logger.new($stdout)  config.logger.level = Logger::INFOendSidekiq.configure_client do |config|  redis_options = {     url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1'),     ssl_params: ssl_params   }  Rails.logger.info "Sidekiq client Redis options: #{redis_options.inspect}"  config.redis = redis_optionsend
#redis.rbrequire 'uri'require 'redis'redis_uri = URI.parse(ENV['REDIS_URL'] || 'redis://localhost:6379/1')redis_options = {  host: redis_uri.host,  port: redis_uri.port.to_i,  # Convert port to integer  password: redis_uri.password,  ssl: redis_uri.scheme == 'rediss',  # Enable SSL if scheme is 'rediss'  ssl_params: {    verify_mode: OpenSSL::SSL::VERIFY_NONE  # Match ssl_cert_reqs=CERT_NONE  }}redis_options[:port] = redis_uri.port.to_i if redis_uri.port# Initialize Redis clientRedis.new(redis_options)

configuration added:

config.action_cable.url = 'wss://XXXX.herokuapp.com/cable'config.action_cable.allowed_request_origins = [ 'https://XXXX.herokuapp.com']config.action_cable.disable_request_forgery_protection = true`

Gemfile.lock related gems:

sidekiq (6.5.12)connection_pool (\>= 2.2.5, \< 3)rack (\~\> 2.0)redis (\>= 4.5.0, \< 5)

tried different modifications on redis.rb , nothing changed the error

Ruby on Rails - Server Memory Spiking and Users getting logged out

$
0
0

We have a fairly typical Ruby on Rails 6.1 app with a Redis cache store which we are also using for our session store. We are using Devise and an single-page app with lots of graphql requests.

Recently memory has been gradually increasing on the servers until hitting 95%. We're working on resolving...

What's strange is that the responses to the users seem to be that they are getting logged out. Does this make sense? I would expect slow or failing responses but not user sessions being terminated. They can refresh and re-login and usually keep working (perhaps hitting a different web server, currently running with ~6-8 and have been for a long time). Normally I would expect to see errors on the server (via Sentry) that we're having memory allocation issues, but instead we just see users getting logged out and no real errors in Sentry.

The Redis server does not seem to have any elevated metrics (CPU sits are 3%, memory around 25%). The only major change recently has been that we upgraded PostgreSQL from 11 to 15.

Any thoughts on what would be causing users to be logged out?

Generally when the servers hit high memory usage we restart them and that resolves the issue.

To fix the memory issues we're looking at jemalloc and resizing the servers.

How can I delete specific jobs from Resque queue without clearing the whole queue?

$
0
0

I'm using Resque workers to process job in a queue, I have a large number of jobs > 1M in a queue and have some of the jobs that I need to remove ( added by error). Crating the queue with the jobs was not an easy tasks, so clearing the queue using resque-web and adding the correct jobs again is not an option for me.

Appreciate any advice. Thanks!

Deploy Ruby on Rails app with railway.app

$
0
0

I'm trying to deploy my app on railway.app with Redis (using Sidekiq).I'm using buildpacks and the problem is I have 2 buildpacks and railway says in its documentation only one buildpack is executed in the Procfile.This is my Procfile:

web: bundle exec puma -C config/puma.rbworker: bundle exec sidekiq

How could I execute both processes?

NoMethodError: undefined method `jobs' for module Sidekiq::Job

$
0
0

In my event service I'm trying to delete a job, but I see this:

NoMethodError: undefined method `jobs' for module Sidekiq::Job

I know that it is possible to delete using ScheduledSet, but I cannot write tests using it.Service:

# frozen_string_literal: truemodule Api  module V1    module Events      class Destroy < BaseService        attr_reader :event        def initialize(event:)          @event = event        end        def call          cancel_notification          event.destroy          success!(event)        end        private        def cancel_notification          return if event.notification_job_id.blank? || Sidekiq::Worker.jobs.empty?          Sidekiq::Job.jobs.reject! { |job| job["jid"] == event.notification_job_id }        end      end    end  endend

I tried to use Sidekiq::Workers, Sidekiq::Worker(alias) but see the same thing


Issue with Sidekiq and Redis in Production on Rails 7.0.8.1

$
0
0

I'm experiencing issues configuring Sidekiq in my production environment. The application is a Rails 7.0.8.1 running on an Ubuntu 22.04 server, and the installed Redis version is 7.2.5. However, when starting Sidekiq, it tries to connect to an older version of Redis (6.0.16), causing it to fail.

Environment SetupSystemd Service File (/etc/systemd/system/sidekiq.service):

[Unit]Description=SidekiqAfter=syslog.target network.target[Service]Type=simpleWorkingDirectory=/home/deploy/lipepay/currentExecStart=/home/deploy/start_sidekiq.shUser=deployGroup=deployUMask=0002RestartSec=15Restart=alwaysEnvironment=REDIS_URL=redis://127.0.0.1:6379/0[Install]WantedBy=multi-user.target

Startup Script (/home/deploy/start_sidekiq.sh):

#!/bin/bash# File: /home/deploy/start_sidekiq.sh# Load Ruby version manager environmentexport PATH="$HOME/.rbenv/bin:$PATH"eval "$(rbenv init -)"# Set REDIS_URLexport REDIS_URL=redis://127.0.0.1:6379/0# Navigate to application directorycd /home/deploy/lipepay/current# Start Sidekiqexec /home/deploy/.rbenv/shims/bundle exec sidekiq -e production

Sidekiq Initializer (config/initializers/sidekiq.rb):

require 'sidekiq/cron'if Rails.env.production?  schedule_file = "config/schedule.yml"  if File.exist?(schedule_file) && Sidekiq.server?    yaml_jobs = YAML.load_file(schedule_file)    existing_jobs = Sidekiq::Cron::Job.all.map(&:name)    yaml_jobs.each do |name, details|      unless existing_jobs.include?(name)        Sidekiq::Cron::Job.create(name: name, cron: details['cron'], class: details['class'])      end    end  end  Sidekiq.configure_server do |config|    config.redis = { url: ENV['REDIS_URL'] }  end  Sidekiq.configure_client do |config|    config.redis = { url: ENV['REDIS_URL'] }  endend

Error LogsHere is the output from journalctl -u sidekiq:

Jun 26 17:34:27 ubuntu-2gb-hil-1 start_sidekiq.sh[348225]: You are connecting to Redis 6.0.16, Sidekiq requires Redis 6.2.0 or greaterJun 26 17:34:27 ubuntu-2gb-hil-1 start_sidekiq.sh[348225]: /home/deploy/lipepay/shared/bundle/ruby/3.3.0/gems/sidekiq-7.1.1/lib/sidekiq/cli.rb:184:in `verify_sufficient_redis_version'

Steps TakenCheck Redis Version:

redis-server --version# Output: Redis server v=7.2.5 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=d2f534f69a26fea

Verify Connection in Rails Console:

redis = Redis.new(url: ENV['REDIS_URL'])puts redis.info["redis_version"]# Output: 7.2.5

Check Dependencies in Gemfile.lock:

grep sidekiq Gemfile.lock# Output:# sidekiq (7.1.1)# sidekiq-cron (1.10.1)

Also sidekiq seems to be correctly configured:

sudo systemctl status sidekiq:

● sidekiq.service - Sidekiq     Loaded: loaded (/etc/systemd/system/sidekiq.service; enabled; vendor preset: enabled)     Active: active (running) since Thu 2024-06-27 20:42:21 UTC; 8min ago   Main PID: 805007 (ruby)      Tasks: 11 (limit: 2252)     Memory: 171.8M        CPU: 3.620s     CGroup: /system.slice/sidekiq.service└─805007 "sidekiq 7.1.1 lipepay [0 of 5 busy]" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.015Z pid=805007 tid=hd1v INFO: Upgrade to Sidekiq Pro for mor>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.015Z pid=805007 tid=hd1v INFO: Sidekiq 7.1.1 connecting to Re>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.019Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.021Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.023Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.025Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.027Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.029Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.030Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>Jun 27 20:42:24 ubuntu-2gb-hil-1 start_sidekiq.sh[805007]: 2024-06-27T20:42:24.032Z pid=805007 tid=hd1v INFO: Cron Jobs - added job with nam>lines 1-20/20 (END)

Rails/Redis ActiveRecord::RecordNotFound error even when the record clearly exists

$
0
0

I am currently working on a piece of software for the company I am working at, and I am at a complete loss as to how I can resolve this error.

This is what Sidekiq spits back at me

09:26:23 sidekiq.1 | 2024-07-02T13:26:22.990Z pid=45032 tid=17cw WARN: ActiveRecord::RecordNotFound: Couldn't find Quote with 'id'=1758

I can't share too much code, but below should be enough

class CreateOrUpdateApiJob < ApplicationJob  queue_as :default  # Called with quote=1758 and action=create  def perform(quote, action)     Quote.find(quote)     if action == "create"          ApiService.create()     elsif action === "update"          ApiService.update()     end  endend# This is queued withCreateOrUpdateApiJob.perform_later(quote, "create")

What I am working with:

  • MacBook Pro 2015, 2.8 Ghz Quad Intel Core i7, 16GB of 1600MHz DDR3, 1TB SSD, AMD Radeon R9 M370X 2GB, macOS Monterey 12.7.5

  • Ruby 3.1.4, via rbenv

  • PostgreSQL v15 server

  • Gems

    • Rails 6.1.7.4

    • Sidekiq 7.1.2

    • ActiveRecord 6.1.7.4

    • redis 4.8.1, redis-client 0.15.0

    • pg 1.5.4

The commands I run (via the foreman gem):

bundle exec rails server -p 3000 -e productionredis-server # Omitted in production, we have a separate Redis for productionbundle exec sidekiq -c 2 -q default -q mailers

I have tried just about everything. Whether it be passing the whole record into the quote argument, sending the record as a string and parsing, installing Redis fresh, it just doesn't work.

Rails 7.1 Error when reading active record model from redis cache

$
0
0

We have a problem during upgrade Rails from 7.0.8 to 7.1.3.2 with reading AR models from Redis cache.

We have several places where we cache AR models with Redis:

Rails.cache.fetch("key_name") { Ar_Model[some_key] }

After Rails upgrade we can't read all params (except id) from model. Example:

Run two same consoles.In one of them:

model = Rails.cache.fetch("key_name") { Ar_Model[some_key] }model.class => Ar_Model(id: integer, name: string)model.name => "some_name"

But in the second console:

model = Rails.cache.fetch("key_name")model.class => Ar_Model(id: integer, name: string)model.id => some_idmodel.name => Error! Unknown method 'name' for Ar_Model()

Interestingly, after run, for example, Ar_Model.first in the second console, we can read all params from model without any reloading.

model = Rails.cache.fetch("key_name")model.class => Ar_Model(id: integer, name: string)model.id => some_idmodel.name => Error! Unknown method 'name' for Ar_Model()Ar_Model.firstmodel.name => "some_name"

Rails 7.1 Turbo stream not working on localhost, but works when deployed to Heroku

$
0
0

I have a very simple Rails 7.1.3.4 app that is essentially a dashboard, where it uses Turbo Streams to display model attributes in real-time. When I deploy my app to Heroku, everything works as expected. But on localhost, my view does not update when there's a change to the model.

The best I can tell, there's some Redis config issue. I've updated config/cable.yml to have

development:  adapter: redis  url: redis://localhost:6379/1

I've added a Redis initializer that sets up REDIS = Redis.new(url: "redis://localhost:6379/1")

In a rails console, REDIS.ping returns PONG.

When I update a model's attribute using update_attribute, an Enqueued Turbo::Streams::BroadcastStreamJob is logged.

And when I load my view in a web browser, I see <turbo-cable-stream-source channel="Turbo::StreamsChannel" etc in the html. There are no errors in the "Console" section of Chrome dev tools, but also no activity in "Network" when an attribute updates.

That is, until I deploy the app to Heroku, which is also using Redis. My Heroku app has Network activity and the view updates appropriately.

I've compared my production.rb and development.rb config environments, and nothing jumps out to me as the potential cause. I've also added

config.action_cable.allowed_request_origins = [ 'http://localhost:3000' ]config.action_cable.url = "ws://localhost:3000/cable"

to config/environments/development.rb. What could I be missing in my local set up?

Is there a way to access session stored in redis in log configuration stage in rails?

$
0
0

I have a rails 7 web app, which uses redis, hiredis, redis-actionpack to store session data. We also use devise for auth. Now, I wish to use log tags to include user_id in every line the logger logs. Is there a way to do this without me having to call redis.get directly and Marshaling stuff out?

If we used cookie store - the default thing, shaking the cookie jar would work -

   # Prepend all log lines with the following tags.    config.log_tags = [:request_id, proc do |req|      session_key = Rails.application.config.session_options[:key]      session_data = req.cookie_jar.encrypted[session_key]      if session_data.present?        warden_data = session_data['warden.user.user.key']"user_id: #{warden_data[0][0]}" if warden_data.present?      end    end]

But I don't want to touch redis directly.
I have tried req.session.to_hash or req.session[:_csrf_token] etc to try and force it, but it doesn't stick. I always get an empty {} back, staring blankly!

How can I use any higher level function to access session data?

Store Rails session using Redis

$
0
0

The default session store for Rails is cookie_store. This makes the session be stored on the client side (correct me if I am wrong).

I want to change this default behavior, so that I can store the sessions into Redis database.The posts/articles I found on the Internet, suggests setup a caching store to use redis_cache_store and then for the session_store, to use cache_store.

As I got it, this means that, both caching and sessions will be using the same database (Instance). I don't want that. I want both sessions and cache to use different instances of Redis, so they can be configured accordingly.

I tried to create an initializer file config/initializers/session_store.rb with the following content:

Rails.application.config.session_store :redis_cache_store, key: '_my_app_session'

But this does not work. It gives me the following error:

/application/configuration.rb:324:in `const_get': uninitialized constant ActionDispatch::Session::RedisCacheStore (NameError)

I also found this gem https://github.com/redis-store/redis-store but I am not sure how problematic using this gem can be, since Rails already has a built-in Redis cache store (https://github.com/rails/rails/pull/31134)

Whats the best practice way to initialise a Redis pub/sub subscriber in a Rails app when it starts up?

$
0
0

I have a collection of Rails apps, and I want to have some of them subscribe to a channel waiting for messages. They are all connected to the same Redis server already, but I'm just not sure where to place the code that starts the subscriber to listen for messages.

Should I have a class in config/initializers that starts a new thread and calls the redis.subscribe method?

Should I perform a Resque job from an initializer class that is in its own dedicated queue and has its own dedicated worker which then calls the redis.subscribe?

Are there other ideas of how I should do this? Or does this just not makes sense overall?

I haven't full tried either yet, I have just been fumbling around looking for recommendations.


Herkou Redis - certificate verify failed (self signed certificate in certificate chain)

$
0
0

I have been using heroku redis for a while now on one of my side projects. I currently use it for 3 things

  1. It serves as a place for me to store firebase certificates
  2. It is used for caching data on the site
  3. It is used for rails sidekiq jobs

Recently, my heroku usage went up and I had to change it to use heroku redis premium plan. Ever since then I have been getting error: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate in certificate chain) somehow. Everything stayed the same yet the error started popping out of nowhere.

Does heroku-redis premium plan work fundamentally different than a basic heroku-redis plan?

I am using ruby on rails, deployed on heroku with heroku redis if that helps.

SSE over https not working

$
0
0

I am having an issue with SSE over https, let me make it clear, I have an Nginx server that listen to https, and a Rails Puma in the back, So I have this in the js( coffescript ):

initStream = () ->   rechargePayment.source = new     EventSource('/proggress/stream')

and in the rails controller I have:

  def stream    response.headers['Content-Type'] = 'text/event-stream'    redis = Redis.new    redis.psubscribe(['proggress.refresh', 'heartbeat']) do |on|      on.pmessage do |_pattern, event, data|        response.stream.write("event: #{event}\n")        response.stream.write("data: #{data}\n\n")      end    end  rescue IOError    logger.info 'Stream stoped'  ensure    logger.info 'Stopping Stream Thread'    redis.quit    response.stream.close  end

When I try this over https, it does nothing, in the logs I only see the error: "Stream closed", but if I try it over http it works perfectly.

EDIT: I saw this:"The EventSource interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection."

source: https://developer.mozilla.org/en-US/docs/Web/API/EventSource

So, does this mean that it works only in http?

redis-rails and acl getting NOPERM with turbo broadcast

$
0
0

We are trying to set passwords on our redis.

redis.conf:

user default on >xxxxxxxx ~* +@alluser user01 on >xxxxxxxx ~* +@all

In our environment variables we have:

REDIS_URL=redis://user01:xxxxxx@xxx.xxx.xxx.xxx:6379/1

and cable.yml has:

production:  adapter: redis  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>  channel_prefix: my_app_production

But when we try and do a turbo broadcast we get:

[a-b-c-d-e] Failed to process job: NOPERM this user has no permissions to access one of the channels used as arguments (redis://xxx.xxx.xxx.xxx:6379/1)

For completeness here's the versions:

$ redis-server --versionRedis server v=7.0.15 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=d81b8ff71cfb150e  * redis (5.3.0)  * redis-client (0.22.2)

How to enable TLS for Redis 6 on Sidekiq?

$
0
0

Problem

On my Ruby on Rails app, I keep getting the error below for the Heroku Redis Premium 0 add-on:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate in certificate chain)

Heroku Redis documentation mentions that I need to enable TLS in my Redis client's configuration in order to connect to a Redis 6 database. To achive this, I have read SSL/TLS Support documentation on redis-rb. My understanding from it is; I need to assign ca_file, cert and key for Redis.new#ssl_params. The question is how to set these for Redis or through Sidekiq on Heroku?

Updates

Update 3: Heroku support provided an answer which solved the problem.

Update 2: Created Heroku support ticket and waiting response.

Update 1: Asked on Sidekiq's Github issues and was adviced go write Heroku support. Will update this question, when I do get an answer.


Related Info

I have verified the app does work when the add-on is either one of the below:

  • hobby-dev for Redis 6
  • premium 0 for Redis 5

Versions:

  • Ruby – 3.0.0p0
  • Ruby on Rails – 6.1.1
  • Redis – 6.0
  • redis-rb – 4.2.5
  • Sidekiq – 6.2.1
  • Heroku Stack – 20

Some links that helped me to narrow down the issue:

Uploading video to S3 via sidekiq / Carrierwave on Heroku rails app

$
0
0

I have a Rails 7 app running on Heroku. The app is simple, in theory: Users sign up, and can upload video files as part of a survey.

I'm using Carrierwave for the upload process, but ran into memory and timeout issues using Heroku. I've tried to implement the carrierwave-backgrounder gem alongside sidekiq and redis.

I've pushed to a staging app on Heroku and the timeouts on form submit seem to be resolved, but the files aren't being uploaded to the S3 bucket. I've set the S3 credentials in the staging app's config vars the same as on the production app.

Inspecting the Video record in the rails console shows filenames in the relevant table columns, but no files are showing in the S3 bucket.

Video.rb:

class Video < ApplicationRecord  mount_uploaders :video_files, VideoUploader  store_in_background :video_filesend

carrierwave.rb

CarrierWave.configure do |config|  config.fog_credentials = {    provider:              'AWS',                        # required    aws_access_key_id:     ENV.fetch('AWS_ACCESS_KEY_ID'),                        # required unless using use_iam_profile    aws_secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),                        # required unless using use_iam_profile    use_iam_profile:       true,                         # optional, defaults to false    region:                ENV.fetch('AWS_REGION')                  # optional, defaults to 'us-east-1'  }  config.fog_directory  = ENV.fetch('S3_BUCKET_NAME')                                    # required  config.fog_public     = false                                                 # optional, defaults to true  config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}  # For an application which utilizes multiple servers but does not need caches persisted across requests,  # uncomment the line :file instead of the default :storage.  Otherwise, it will use AWS as the temp cache store.  # config.cache_storage = :fileend

VideoUploader.rb

class VideoUploader < CarrierWave::Uploader::Base  include ::CarrierWave::Backgrounder::Delay  cache_storage CarrierWave::Storage::File  def cache_dir"uploads_cache/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"  end  storage :fog  def store_dir"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"  end  def extension_allowlist    %w(mp4 mov avi)  endend

initializers/carrierwave_backgrounder.rb

CarrierWave::Backgrounder.configure do |c|  c.backend :sidekiq, queue: :carrierwaveend

initializers/sidekiq.rb

Sidekiq.configure_server do |config|  config.redis = {    url: ENV["REDIS_URL"],    ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }  }endSidekiq.configure_client do |config|  config.redis = {      url: ENV["REDIS_URL"],      ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }  }end

sidekiq.yml

:queues:  - [carrierwave, 1]  - default

redis.rb

$redis = Redis.new(url: ENV["REDIS_URL"], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE })

Procfile

worker: bundle exec sidekiq -c 2

Redis: weird protocol/network errors

$
0
0

I'm running Redis and connecting from Ruby using ezmobius's Redis gem[1].

Periodically (about once a day) I get a series of exceptions in my Rails app caused by Redis returning strange results.

They are often triggered by an exception such at this:

Redis::ProtocolError: Protocol error, got '3' as initial reply byte                         

or

Redis::ProtocolError: Protocol error, got '9' as initial reply byte                      

or sometimes

Errno::EAGAIN: Resource temporarily unavailable - Timeout reading from the socket

It usually requires a restart of my Rails servers to clear up the connection problem. I'm running Fedora Core 8, Rails 2.3.8, Redis gem 2.0.3. I've got the system_timer gem installed. Anybody got any ideas how I can stop these errors?

[1]Redis gem

Rails error: can't activate redis (>= 3, < 5), already activated redis-5.0.4

$
0
0

I tried to deploy my Rails app, and got the error

can't activate redis (>= 3, < 5), already activated redis-5.0.4. Make sure all dependencies are added to Gemfile. (Gem::LoadError)

I've tried deleting the gemfile, running bundle install/update but no joy. I've also tried specifying redis 4.8.0 in my gemfile but still got the same error.

My gemfile:

source 'https://rubygems.org'git_source(:github) { |repo| "https://github.com/#{repo}.git" }ruby '2.7.0'# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'gem 'rails', '~> 6.0.4'# Use postgresql as the database for Active Recordgem 'pg', '>= 0.18', '< 2.0'# Use Puma as the app servergem 'puma', '~> 3.11'# Use SCSS for stylesheetsgem 'sass-rails', '~> 5.0'# Use Uglifier as compgiffnressor for JavaScript assetsgem 'uglifier', '>= 1.3.0'gem 'execjs'# See https://github.com/rails/execjs#readme for more supported runtimesgem 'csv'gem 'i18n', '1.8.11'gem 'coffee-rails', '~> 4.2'# Build JSON APIs with ease. Read more: https://github.com/rails/jbuildergem 'jbuilder', '~> 2.5'gem 'jquery-rails'gem 'rails_12factor'gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '3543363026121ee28d98dfce4cb6366980c055ee'gem 'by_star', git: 'https://github.com/radar/by_star'gem 'forest_liana'gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master'gem 'pagy', '~> 5.10'gem 'will_paginate', '~> 3.1.0'gem 'will_paginate_infinite'gem 'devise'gem 'friendly_id', '~> 5.4.0'gem 'cloudinary'gem 'attachinary', git: 'https://github.com/ThomasConnolly/attachinary.git'gem 'carrierwave'gem 'alphabetical_paginate'gem 'stripe', '~> 5.14.0'gem 'omniauth-stripe-connect'gem 'stripe_event'gem 'httparty'gem "banktools-gb"gem "numbers_and_words"gem 'fcm'gem 'resque'gem 'resque_mailer'gem 'resque-scheduler'gem 'resque-heroku-signals'gem 'rails_admin', '~> 2.0'gem 'cancancan'gem "administrate"gem 'country_select', '~> 4.0'gem "font-awesome-rails"gem 'devise-bootstrap-views'gem "twitter-bootstrap-rails"gem 'bootstrap-sass', '~> 3.3.7'# Use Redis adapter to run Action Cable in productiongem 'redis'gem 'gon'gem 'sendgrid'gem 'add_event'gem "serviceworker-rails"gem "simple_calendar", "~> 2.4"# Use ActiveModel has_secure_password# gem 'bcrypt', '~> 3.1.7'# Use ActiveStorage variant# gem 'mini_magick', '~> 4.8'# Use Capistrano for deployment# gem 'capistrano-rails', group: :developmentgem 'listen'# Reduces boot times through caching; required in config/boot.rbgem 'bootsnap', '>= 1.1.0', require: falsegroup :development, :test do  # Call 'byebug' anywhere in the code to stop execution and get a debugger console  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]endgroup :development do  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.  gem 'web-console', '>= 3.3.0'  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring  gem 'spring'  gem 'spring-watcher-listen', '~> 2.0.0'endgroup :test do  # Adds support for Capybara system testing and selenium driver  gem 'capybara', '>= 2.15'  gem 'selenium-webdriver'  # Easy installation and use of chromedriver to run system tests with Chrome  gem 'chromedriver-helper'end# Windows does not include zoneinfo files, so bundle the tzinfo-data gemgem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gemfile.lock:

GIT  remote: https://github.com/ThomasConnolly/attachinary.git  revision: c7bbc9d5d5ea6aee7584e381c82d0b5bea73e49b  specs:    attachinary (1.3.1)      cloudinary (~> 1.1)      rails (>= 3.2)GIT  remote: https://github.com/faker-ruby/faker.git  revision: 4f4c1a330963de84ea188f97de12e6895217eac3  branch: master  specs:    faker (2.23.0)      i18n (>= 1.8.11, < 2)GIT  remote: https://github.com/mimemagicrb/mimemagic.git  revision: 3543363026121ee28d98dfce4cb6366980c055ee  ref: 3543363026121ee28d98dfce4cb6366980c055ee  specs:    mimemagic (0.3.2)GIT  remote: https://github.com/radar/by_star  revision: d7811c0c50f30262b4862b384c50f22f36e54f07  specs:    by_star (4.0.0)      activesupport (>= 3.2.0)GEM  remote: https://rubygems.org/  specs:    actioncable (6.0.6)      actionpack (= 6.0.6)      nio4r (~> 2.0)      websocket-driver (>= 0.6.1)    actionmailbox (6.0.6)      actionpack (= 6.0.6)      activejob (= 6.0.6)      activerecord (= 6.0.6)      activestorage (= 6.0.6)      activesupport (= 6.0.6)      mail (>= 2.7.1)    actionmailer (6.0.6)      actionpack (= 6.0.6)      actionview (= 6.0.6)      activejob (= 6.0.6)      mail (~> 2.5, >= 2.5.4)      rails-dom-testing (~> 2.0)    actionpack (6.0.6)      actionview (= 6.0.6)      activesupport (= 6.0.6)      rack (~> 2.0, >= 2.0.8)      rack-test (>= 0.6.3)      rails-dom-testing (~> 2.0)      rails-html-sanitizer (~> 1.0, >= 1.2.0)    actiontext (6.0.6)      actionpack (= 6.0.6)      activerecord (= 6.0.6)      activestorage (= 6.0.6)      activesupport (= 6.0.6)      nokogiri (>= 1.8.5)    actionview (6.0.6)      activesupport (= 6.0.6)      builder (~> 3.1)      erubi (~> 1.4)      rails-dom-testing (~> 2.0)      rails-html-sanitizer (~> 1.1, >= 1.2.0)    activejob (6.0.6)      activesupport (= 6.0.6)      globalid (>= 0.3.6)    activemodel (6.0.6)      activesupport (= 6.0.6)    activemodel-serializers-xml (1.0.2)      activemodel (> 5.x)      activesupport (> 5.x)      builder (~> 3.1)    activerecord (6.0.6)      activemodel (= 6.0.6)      activesupport (= 6.0.6)    activestorage (6.0.6)      actionpack (= 6.0.6)      activejob (= 6.0.6)      activerecord (= 6.0.6)      marcel (~> 1.0)    activesupport (6.0.6)      concurrent-ruby (~> 1.0, >= 1.0.2)      i18n (>= 0.7, < 2)      minitest (~> 5.1)      tzinfo (~> 1.1)      zeitwerk (~> 2.2, >= 2.2.2)    add_event (0.1.0)      addressable (~> 2.3)    addressable (2.8.1)      public_suffix (>= 2.0.2, < 6.0)    administrate (0.18.0)      actionpack (>= 5.0)      actionview (>= 5.0)      activerecord (>= 5.0)      jquery-rails (>= 4.0)      kaminari (>= 1.0)      sassc-rails (~> 2.1)      selectize-rails (~> 0.6)    aes_key_wrap (1.1.0)    alphabetical_paginate (2.3.4)    archive-zip (0.12.0)      io-like (~> 0.3.0)    arel-helpers (2.14.0)      activerecord (>= 3.1.0, < 8)    attr_extras (6.2.5)    attr_required (1.0.1)    autoprefixer-rails (10.4.7.0)      execjs (~> 2)    aws_cf_signer (0.1.3)    banktools-gb (0.13.1)      attr_extras    bcrypt (3.1.18)    bindata (2.4.10)    bindex (0.8.1)    bootsnap (1.13.0)      msgpack (~> 1.2)    bootstrap-sass (3.3.7)      autoprefixer-rails (>= 5.2.1)      sass (>= 3.3.4)    builder (3.2.4)    byebug (11.1.3)    cancancan (3.4.0)    capybara (3.37.1)      addressable      matrix      mini_mime (>= 0.1.3)      nokogiri (~> 1.8)      rack (>= 1.6.0)      rack-test (>= 0.6.3)      regexp_parser (>= 1.5, < 3.0)      xpath (~> 3.2)    carrierwave (2.2.2)      activemodel (>= 5.0.0)      activesupport (>= 5.0.0)      addressable (~> 2.6)      image_processing (~> 1.1)      marcel (~> 1.0.0)      mini_mime (>= 0.1.3)      ssrf_filter (~> 1.0)    childprocess (4.1.0)    chromedriver-helper (2.1.1)      archive-zip (~> 0.10)      nokogiri (~> 1.8)    cloudinary (1.23.0)      aws_cf_signer      rest-client (>= 2.0.0)    coffee-rails (4.2.2)      coffee-script (>= 2.2.0)      railties (>= 4.0.0)    coffee-script (2.4.1)      coffee-script-source      execjs    coffee-script-source (1.12.2)    commonjs (0.2.7)    concurrent-ruby (1.1.10)    connection_pool (2.3.0)    countries (3.1.0)      i18n_data (~> 0.11.0)      sixarm_ruby_unaccent (~> 1.1)      unicode_utils (~> 1.4)    country_select (4.0.0)      countries (~> 3.0)      sort_alphabetical (~> 1.0)    crass (1.0.6)    csv (3.2.5)    devise (4.8.1)      bcrypt (~> 3.0)      orm_adapter (~> 0.1)      railties (>= 4.1.0)      responders      warden (~> 1.2.3)    devise-bootstrap-views (1.1.0)    digest (3.1.0)    domain_name (0.5.20190701)      unf (>= 0.0.5, < 1.0.0)    erubi (1.11.0)    execjs (2.8.1)    faraday (2.5.2)      faraday-net_http (>= 2.0, < 3.1)      ruby2_keywords (>= 0.0.4)    faraday-net_http (3.0.0)    fcm (1.0.8)      faraday (>= 1.0.0, < 3.0)      googleauth (~> 1)    ffi (1.15.5)    font-awesome-rails (4.7.0.8)      railties (>= 3.2, < 8.0)    forest_liana (7.7.0)      arel-helpers      bcrypt      forestadmin-jsonapi-serializers (>= 0.14.0)      groupdate (>= 5.0.0)      httparty      ipaddress      json      json-jwt      jwt      openid_connect      rack-cors      rails (>= 4.0)      useragent    forestadmin-jsonapi-serializers (2.0.0.pre.beta.2)      activesupport    friendly_id (5.4.2)      activerecord (>= 4.0.0)    globalid (1.0.0)      activesupport (>= 5.0)    gon (6.4.0)      actionpack (>= 3.0.20)      i18n (>= 0.7)      multi_json      request_store (>= 1.0)    googleauth (1.2.0)      faraday (>= 0.17.3, < 3.a)      jwt (>= 1.4, < 3.0)      memoist (~> 0.16)      multi_json (~> 1.11)      os (>= 0.9, < 2.0)      signet (>= 0.16, < 2.a)    groupdate (6.1.0)      activesupport (>= 5.2)    haml (5.2.2)      temple (>= 0.8.0)      tilt    hashie (5.0.0)    http-accept (1.7.0)    http-cookie (1.0.5)      domain_name (~> 0.5)    httparty (0.20.0)      mime-types (~> 3.0)      multi_xml (>= 0.5.2)    httpclient (2.8.3)    i18n (1.8.11)      concurrent-ruby (~> 1.0)    i18n_data (0.11.0)    image_processing (1.12.2)      mini_magick (>= 4.9.5, < 5)      ruby-vips (>= 2.0.17, < 3)    io-like (0.3.1)    ipaddress (0.8.3)    jbuilder (2.11.5)      actionview (>= 5.0.0)      activesupport (>= 5.0.0)    jquery-rails (4.5.0)      rails-dom-testing (>= 1, < 3)      railties (>= 4.2.0)      thor (>= 0.14, < 2.0)    jquery-ui-rails (6.0.1)      railties (>= 3.2.16)    json (2.6.2)    json-jwt (1.15.3)      activesupport (>= 4.2)      aes_key_wrap      bindata      httpclient    jwt (2.5.0)    kaminari (1.2.2)      activesupport (>= 4.1.0)      kaminari-actionview (= 1.2.2)      kaminari-activerecord (= 1.2.2)      kaminari-core (= 1.2.2)    kaminari-actionview (1.2.2)      actionview      kaminari-core (= 1.2.2)    kaminari-activerecord (1.2.2)      activerecord      kaminari-core (= 1.2.2)    kaminari-core (1.2.2)    less (2.6.0)      commonjs (~> 0.2.7)    less-rails (4.0.0)      actionpack (>= 4)      less (~> 2.6.0)      sprockets (>= 2)    listen (3.7.1)      rb-fsevent (~> 0.10, >= 0.10.3)      rb-inotify (~> 0.9, >= 0.9.10)    loofah (2.19.0)      crass (~> 1.0.2)      nokogiri (>= 1.5.9)    mail (2.7.1)      mini_mime (>= 0.1.1)    marcel (1.0.2)    matrix (0.4.2)    memoist (0.16.2)    method_source (1.0.0)    mime-types (3.4.1)      mime-types-data (~> 3.2015)    mime-types-data (3.2022.0105)    mini_magick (4.11.0)    mini_mime (1.1.2)    minitest (5.16.3)    msgpack (1.5.6)    multi_json (1.15.0)    multi_xml (0.6.0)    nested_form (0.3.2)    net-protocol (0.1.3)      timeout    net-smtp (0.3.1)      digest      net-protocol      timeout    netrc (0.11.0)    nio4r (2.5.8)    nokogiri (1.13.8-x86_64-darwin)      racc (~> 1.4)    numbers_and_words (0.11.11)      i18n (<= 2)    oauth2 (2.0.9)      faraday (>= 0.17.3, < 3.0)      jwt (>= 1.0, < 3.0)      multi_xml (~> 0.5)      rack (>= 1.2, < 4)      snaky_hash (~> 2.0)      version_gem (~> 1.1)    omniauth (1.9.2)      hashie (>= 3.4.6)      rack (>= 1.6.2, < 3)    omniauth-oauth2 (1.7.3)      oauth2 (>= 1.4, < 3)      omniauth (>= 1.9, < 3)    omniauth-stripe-connect (2.10.1)      omniauth (~> 1.3)      omniauth-oauth2 (~> 1.4)    openid_connect (1.3.1)      activemodel      attr_required (>= 1.0.0)      json-jwt (>= 1.5.0)      net-smtp      rack-oauth2 (>= 1.6.1)      swd (>= 1.0.0)      tzinfo      validate_email      validate_url      webfinger (>= 1.0.1)    orm_adapter (0.5.0)    os (1.1.4)    pagy (5.10.1)      activesupport    pg (1.4.3)    public_suffix (5.0.0)    puma (3.12.6)    racc (1.6.0)    rack (2.2.4)    rack-cors (1.1.1)      rack (>= 2.0.0)    rack-oauth2 (1.21.3)      activesupport      attr_required      httpclient      json-jwt (>= 1.11.0)      rack (>= 2.1.0)    rack-pjax (1.1.0)      nokogiri (~> 1.5)      rack (>= 1.1)    rack-test (2.0.2)      rack (>= 1.3)    rails (6.0.6)      actioncable (= 6.0.6)      actionmailbox (= 6.0.6)      actionmailer (= 6.0.6)      actionpack (= 6.0.6)      actiontext (= 6.0.6)      actionview (= 6.0.6)      activejob (= 6.0.6)      activemodel (= 6.0.6)      activerecord (= 6.0.6)      activestorage (= 6.0.6)      activesupport (= 6.0.6)      bundler (>= 1.3.0)      railties (= 6.0.6)      sprockets-rails (>= 2.0.0)    rails-dom-testing (2.0.3)      activesupport (>= 4.2.0)      nokogiri (>= 1.6)    rails-html-sanitizer (1.4.3)      loofah (~> 2.3)    rails_12factor (0.0.3)      rails_serve_static_assets      rails_stdout_logging    rails_admin (2.2.1)      activemodel-serializers-xml (>= 1.0)      builder (~> 3.1)      haml (>= 4.0, < 6)      jquery-rails (>= 3.0, < 5)      jquery-ui-rails (>= 5.0, < 7)      kaminari (>= 0.14, < 2.0)      nested_form (~> 0.3)      rack-pjax (>= 0.7)      rails (>= 5.0, < 7)      remotipart (~> 1.3)      sassc-rails (>= 1.3, < 3)    rails_serve_static_assets (0.0.5)    rails_stdout_logging (0.0.5)    railties (6.0.6)      actionpack (= 6.0.6)      activesupport (= 6.0.6)      method_source      rake (>= 0.8.7)      thor (>= 0.20.3, < 2.0)    rake (13.0.6)    rb-fsevent (0.11.2)    rb-inotify (0.10.1)      ffi (~> 1.0)    redis (5.0.5)      redis-client (>= 0.9.0)    redis-client (0.9.0)      connection_pool    regexp_parser (2.5.0)    remotipart (1.4.4)    request_store (1.5.1)      rack (>= 1.4)    responders (3.0.1)      actionpack (>= 5.0)      railties (>= 5.0)    rest-client (2.1.0)      http-accept (>= 1.7.0, < 2.0)      http-cookie (>= 1.0.2, < 2.0)      mime-types (>= 1.16, < 4.0)      netrc (~> 0.8)    rexml (3.2.5)    ruby-vips (2.1.4)      ffi (~> 1.12)    ruby2_keywords (0.0.5)    rubyzip (2.3.2)    sass (3.7.4)      sass-listen (~> 4.0.0)    sass-listen (4.0.0)      rb-fsevent (~> 0.9, >= 0.9.4)      rb-inotify (~> 0.9, >= 0.9.7)    sass-rails (5.1.0)      railties (>= 5.2.0)      sass (~> 3.1)      sprockets (>= 2.8, < 4.0)      sprockets-rails (>= 2.0, < 4.0)      tilt (>= 1.1, < 3)    sassc (2.4.0)      ffi (~> 1.9)    sassc-rails (2.1.2)      railties (>= 4.0.0)      sassc (>= 2.0)      sprockets (> 3.0)      sprockets-rails      tilt    selectize-rails (0.12.6)    selenium-webdriver (4.4.0)      childprocess (>= 0.5, < 5.0)      rexml (~> 3.2, >= 3.2.5)      rubyzip (>= 1.2.2, < 3.0)      websocket (~> 1.0)    sendgrid (1.2.4)      json    serviceworker-rails (0.6.0)      railties (>= 3.1)    signet (0.17.0)      addressable (~> 2.8)      faraday (>= 0.17.5, < 3.a)      jwt (>= 1.5, < 3.0)      multi_json (~> 1.10)    simple_calendar (2.4.3)      rails (>= 3.0)    sixarm_ruby_unaccent (1.2.0)    snaky_hash (2.0.0)      hashie      version_gem (~> 1.1)    sort_alphabetical (1.1.0)      unicode_utils (>= 1.2.2)    spring (2.1.1)    spring-watcher-listen (2.0.1)      listen (>= 2.7, < 4.0)      spring (>= 1.2, < 3.0)    sprockets (3.7.2)      concurrent-ruby (~> 1.0)      rack (> 1, < 3)    sprockets-rails (3.4.2)      actionpack (>= 5.2)      activesupport (>= 5.2)      sprockets (>= 3.0.0)    ssrf_filter (1.1.1)    stripe (5.14.0)    stripe_event (2.6.0)      activesupport (>= 3.1)      stripe (>= 2.8, < 8)    swd (1.3.0)      activesupport (>= 3)      attr_required (>= 0.0.5)      httpclient (>= 2.4)    temple (0.8.2)    thor (1.2.1)    thread_safe (0.3.6)    tilt (2.0.11)    timeout (0.3.0)    twitter-bootstrap-rails (5.0.0)      actionpack (>= 5.0, < 8.0)      execjs (~> 2.7)      less-rails (>= 3.0, < 5.0)      railties (>= 5.0, < 8.0)    tzinfo (1.2.10)      thread_safe (~> 0.1)    uglifier (4.2.0)      execjs (>= 0.3.0, < 3)    unf (0.1.4)      unf_ext    unf_ext (0.0.8.2)    unicode_utils (1.4.0)    useragent (0.16.10)    validate_email (0.1.6)      activemodel (>= 3.0)      mail (>= 2.2.5)    validate_url (1.0.15)      activemodel (>= 3.0.0)      public_suffix    version_gem (1.1.1)    warden (1.2.9)      rack (>= 2.0.9)    web-console (4.2.0)      actionview (>= 6.0.0)      activemodel (>= 6.0.0)      bindex (>= 0.4.0)      railties (>= 6.0.0)    webfinger (1.2.0)      activesupport      httpclient (>= 2.4)    websocket (1.2.9)    websocket-driver (0.7.5)      websocket-extensions (>= 0.1.0)    websocket-extensions (0.1.5)    will_paginate (3.1.8)    will_paginate_infinite (0.1.3)      will_paginate (~> 3.0, >= 3.0.3)    xpath (3.2.0)      nokogiri (~> 1.8)    zeitwerk (2.6.0)PLATFORMS  x86_64-darwin-20DEPENDENCIES  add_event  administrate  alphabetical_paginate  attachinary!  banktools-gb  bootsnap (>= 1.1.0)  bootstrap-sass (~> 3.3.7)  by_star!  byebug  cancancan  capybara (>= 2.15)  carrierwave  chromedriver-helper  cloudinary  coffee-rails (~> 4.2)  country_select (~> 4.0)  csv  devise  devise-bootstrap-views  execjs  faker!  fcm  font-awesome-rails  forest_liana  friendly_id (~> 5.4.0)  gon  httparty  i18n (= 1.8.11)  jbuilder (~> 2.5)  jquery-rails  listen  mimemagic!  numbers_and_words  omniauth-stripe-connect  pagy (~> 5.10)  pg (>= 0.18, < 2.0)  puma (~> 3.11)  rails (~> 6.0.4)  rails_12factor  rails_admin (~> 2.0)  redis  sass-rails (~> 5.0)  selenium-webdriver  sendgrid  serviceworker-rails  simple_calendar (~> 2.4)  spring  spring-watcher-listen (~> 2.0.0)  stripe (~> 5.14.0)  stripe_event  twitter-bootstrap-rails  tzinfo-data  uglifier (>= 1.3.0)  web-console (>= 3.3.0)  will_paginate (~> 3.1.0)  will_paginate_infiniteRUBY VERSION   ruby 2.7.0p0BUNDLED WITH   2.3.21

Any help would be massively appreciated, I have no idea why this error has started happening.


Finding Scheduled Delayed job in resque via rails console

$
0
0

In Rails we can get the workers infor easily. I used resque-schedule for delayed Job purpose and now I want to fetch all delayed job list via rails console.



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>