奇怪的延迟工作行为

问题描述

| 我有一份工作(按
delayed_job
安排)在新用户注册到应用程序时发送电子邮件。这是用户模型:
class User < ActiveRecord::Base
  devise :database_authenticatable,:registerable,:recoverable,:rememberable,:trackable,:validatable
  attr_accessible :email,:password,:password_confirmation,:remember_me,:country,:phone_number,:opt_in

  def email=(email)
    super
    Delayed::Job.enqueue self
  end

  def perform
    begin
      UserMailer.welcome_email self
    rescue => e
      STDERR.puts \"Cannot perform the mailer: #{e}\"
    end
  end
end
负责注册新用户的操作是:
def  create
   user = User.new({:email => params[:email],:password => params[:password],:password_confirmation => params[:password_confirmation],:country => params[:country],:opt_in => Boolean(params[:opt_in]),:phone_number => params[:phone_number]})

      if user.save(:validate => false)
        redirect_to wrap_users_path
      end 
end
当用户注册时,我得到以下日志:   开始了POST \“ / wrap_users \”   ...在2011-05-30 12:58:35 +0200 WrapUsersController#create处理为HTML      参数:   {\“电子邮件\” => \“ xxxx \”,   \“密码\” => \“ [已过滤] \”,   \“ password_confirmation \” => \“ [FILTERED] \”,   \“ phone_number \” => \“ xxx \”,   \“ opt_in \” => \“ true \”,\“国家\” => \“法国\”}      AREL(0.3ms)插入   \“ delayed_jobs \”(\“ priority \”,   \“尝试\”,\“处理程序\”,\“ last_error \”,   \“ run_at \”,\“ locked_at \”,\“ failed_at \”,   \“ locked_by \”,\“ created_at \”,   \“ updated_at \”)值(0、0,\'---   ruby / ActiveRecord:用户属性:   电子邮件:xxxx   加密密码:   $ 2a $ 10 $ DwHB / 5zSp38xdAAIkYriSuwIiLyKy2geU5kLmzjz2f1WsAuxpqyIW   reset_password_token:   reset_password_sent_at:   Remember_created_at:sign_in_count:   0 current_sign_in_at:   last_sign_in_at:current_sign_in_ip:   last_sign_in_ip:created_at:   Updated_at:国家/地区:法国opt_in:   真实的电话号码:xxx \',   NULL,\'2011-05-30 10:58:35.250464 \',   NULL,NULL,NULL,\'2011-05-30   10:58:35.250560 \',\'2011-05-30   10:58:35.250560 \')AREL(2.1毫秒)      插入\“用户\”(\“电子邮件\”,   \“ encrypted_pa​​ssword \”,   \“ reset_password_token \”,   \“ reset_password_sent_at \”,   \“ remember_created_at \”,   \“ sign_in_count \”,\“ current_sign_in_at \”,   \“ last_sign_in_at \”,   \“ current_sign_in_ip \”,   \“ last_sign_in_ip \”,\“ created_at \”,   \“ updated_at \”,\“国家\”,\“ opt_in \”,   \“ phone_number \”)VALUES   (\'xxx \',   \'$ 2a $ 10 $ DwHB / 5zSp38xdAAIkYriSuwIiLyKy2geU5kLmzjz2f1WsAuxpqyIW \',   NULL,NULL,NULL,0,NULL,NULL,NULL,   NULL,\'2011-05-30 10:58:35.251788 \',   \'2011-05-30 10:58:35.251788 \',   \'法国\',\'t \',\'xxx \')   重定向到   http:// ...:3000 / wrap_users   277毫秒内完成302发现 如您所见,根据日志,条目被记录到
Delayed::Job
表中。但是实际上,当计算该表中的记录数时(在相同的开发模式下为ѭ4on),我得到0。 到底是怎么回事?日志中没有提到有关“ 5”步骤的任何问题。 谢谢     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)