首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没能和塞蒂克-克伦一起跑。如何设置边框和边框?

没能和塞蒂克-克伦一起跑。如何设置边框和边框?
EN

Stack Overflow用户
提问于 2022-12-01 15:21:35
回答 1查看 24关注 0票数 0

我正试图通过使用sidekiq &sidekiq-cron(用于重复作业)来实现后台作业。但是,当我同时执行app和sidekiq时,执行都失败了。

虽然我已经尽了最大的努力,但我还是找不到任何解决办法。有人能给我一些建议吗?

失败的日志和我的配置如下:应用程序执行失败日志

代码语言:javascript
复制
$ ./bin/rails server                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
=> Booting Puma
=> Rails 7.0.4 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/test1234/projects/test-project/test_bg_job/config/initializers/sidekiq.rb:1:in `<main>': undefined method `options' for Sidekiq:Module (NoMethodError)

Sidekiq.options[:average_scheduled_poll_interval] = 10
       ^^^^^^^^
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:667:in `load'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:667:in `block in load_config_initializer'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:208:in `instrument'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:666:in `load_config_initializer'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:619:in `each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:619:in `block in <class:Engine>'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `instance_exec'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `run'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:50:in `each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `call'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:60:in `run_initializers'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:372:in `initialize!'
        from /Users/test1234/projects/test-project/test_bg_job/config/environment.rb:5:in `<main>'
        from config.ru:3:in `require_relative'
        from config.ru:3:in `block in <main>'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `eval'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `new_from_string'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:105:in `load_file'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:66:in `parse_file'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:349:in `build_app_and_options_from_config'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:249:in `app'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:422:in `wrapped_app'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:36:in `start'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from ./bin/rails:4:in `<main>'

侧翼执行失败日志

代码语言:javascript
复制
undefined method `[]' for Sidekiq:Module

      new_version? ? Sidekiq[key] : Sidekiq.options[key]
                            ^^^^^
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-cron-1.8.0/lib/sidekiq/options.rb:6:in `[]'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-cron-1.8.0/lib/sidekiq/cron/schedule_loader.rb:7:in `block in <main>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq.rb:98:in `configure_server'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-cron-1.8.0/lib/sidekiq/cron/schedule_loader.rb:6:in `<main>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-cron-1.8.0/lib/sidekiq/cron.rb:4:in `<main>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-cron-1.8.0/lib/sidekiq-cron.rb:2:in `<main>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:60:in `block (2 levels) in require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:55:in `each'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:55:in `block in require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:44:in `each'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:44:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler.rb:176:in `require'
/Users/test1234/projects/test-project/test_bg_job/config/application.rb:7:in `<top (required)>'
/Users/test1234/projects/test-project/test_bg_job/config/environment.rb:2:in `require_relative'
/Users/test1234/projects/test-project/test_bg_job/config/environment.rb:2:in `<top (required)>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/cli.rb:301:in `require'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/cli.rb:301:in `boot_application'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/cli.rb:42:in `run'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/bin/sidekiq:31:in `<top (required)>'
/Users/test1234/.asdf/installs/ruby/3.1.2/bin/sidekiq:25:in `load'
/Users/test1234/.asdf/installs/ruby/3.1.2/bin/sidekiq:25:in `<top (required)>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli.rb:484:in `exec'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/libexec/bundle:48:in `block in <top (required)>'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/Users/test1234/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/libexec/bundle:36:in `<top (required)>'
/Users/test1234/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `load'
/Users/test1234/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `<main>'

config/config kiq.yml

代码语言:javascript
复制
:verbose: false
:concurrency: 5
:timeout: 8
:logfile: log/sidekiq.log
staging:
  :concurrency: 5
production:
  :concurrency: 5
:queues:
  - default

config/initializers/sidekiq.rb kiq.rb

代码语言:javascript
复制
Sidekiq.options[:average_scheduled_poll_interval] = 10

Sidekiq.configure_server do |config|
  config.redis = {url: ENV["REDIS_URL"]}
  Rails.logger = Sidekiq.logger
  ActiveRecord::Base.logger = Sidekiq.logger

  schedule_file = "config/schedule.yml"

  if File.exist?(schedule_file)
    Rails.application.config.after_initialize do
      Sidekiq::Cron::Job.load_from_hash! YAML.load_file(schedule_file)
    end
  end
end

Sidekiq.configure_client do |config|
  config.redis = {url: ENV["REDIS_URL"]}
end

config/schedule.yml

代码语言:javascript
复制
my_bg_job:
  cron: "* */1 * * * *"
  class: "MyBgJob"

Gemfile

代码语言:javascript
复制
...
gem 'sidekiq'
gem 'sidekiq-cron'
...
EN

回答 1

Stack Overflow用户

发布于 2022-12-02 17:08:41

我也有同样的问题。

请尝试升级您当前的侧翼-cron版本为1.9.0。版本1.9.0与idekiq7.0兼容。我通过升级的版本解决了这个问题。

这是指向版本1.9.0的点击请求的链接。

(https://github.com/sidekiq-cron/sidekiq-cron/pull/369/files)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74644253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档