ruby-on-rails 从delayed_job到Sidekiq的渐进式迁移需要Ruby文件,因此变得很混乱

whhtz7ly  于 2023-01-14  发布在  Ruby
关注(0)|答案(1)|浏览(116)

我正在尝试从Delayed_Job迁移到Sidekiq。在kubernetes中运行Sidekiq时,出现了一个无法识别的错误:

==================================================================
  Please point Sidekiq to a Rails application or a Ruby file  
  to load your job classes with -r [DIR|FILE].
==================================================================

Kubernetes部署代码段:

...
      containers:
        - name: sidekiq
          image: {{ application_registry }}
          imagePullPolicy: Always
          command:
            - bundle
          args:
            - exec
            - sidekiq
            - -r # not included in the original setting.
            - /app/config/application.rb # not included in the original setting.
            - "-C"
            - "/app/config/sidekiq.yml"
          resources:
            ...

PS:很多现有的作业仍然依赖DelayJob,有些我们计划逐步迁移。所以我们包括每个作业的Sidekiq,而不是全局:

class FirstJob < ApplicationJob
      self.queue_adapter = :sidekiq

      ...

按照一些指南描述的Here。我试图要求在-r标志下的config/application.rb,但没有修复。

mzillmmw

mzillmmw1#

摆脱

- -r # not included in the original setting.
        - /app/config/application.rb # not included in the original setting.
        - "-C"
        - "/app/config/sidekiq.yml"

您需要将当前工作目录设置为/app。

相关问题