水晶与Sidekiq我有一个错误。我做错了什么?

时间:2016-11-03 13:28:00

标签: sidekiq crystal-lang

我试图在Crystal中运行Sidekiq示例,但我在Sidekiq日志中遇到错误:

2016-11-03T13:18:22.430Z 19329 TID-uvtuk WARN: {"queue"=>"default", "jid"=>"84853f6ac0bf8d434ec0beee", "class"=>"Sample::MyWorker", "args"=>["world", 3], "created_at"=>1478179102.4277496, "enqueued_at"=>1478179102.4281816, "retry"=>true}
2016-11-03T13:18:22.430Z 19329 TID-uvtuk WARN: NameError: uninitialized constant Sample

ok_photos> SRC> ok_photos> workers.cr

require "sidekiq"
module Sample
  class MyWorker
    include Sidekiq::Worker

    def perform(name : String, count : Int64)
      count.times do
        logger.info "hello, #{name}!"
      end
    end
  end
end

ok_photos> SRC> ok_photos.cr

require "./ok_photos/*"
require "sidekiq"

Sidekiq::Client.default_context = Sidekiq::Client::Context.new

Sample::MyWorker.async.perform("world", 3_i64)

我做错了什么?

1 个答案:

答案 0 :(得分:2)

您正在显示客户端代码,但不显示服务器代码。服务器不需要您的Sample命名空间,因此它不知道如何执行该作业。