毕竟,我有一种设置延迟作业的方法:
def method
...
RunsJob.set(wait_until: target_date).perform_later(id)
end
在编写规范时,我调用方法并获得:
Failure/Error: RunsJob.set(wait_until: target_date).perform_later(id)
NotImplementedError:
Use a queueing backend to enqueue jobs in the future. Read more at http://guides.rubyonrail
根据ActiveJob文档,要使作业入队,我应该使用perform_later。Sidekiq docs实现了perform_async,但docs suggests using perform_later的ActiveJob部分。我以前在Rails中使用过perform_async,那么它们之间有什么不同呢,还是仅仅是约定?
我创造了一个这样的工作:
class SendEmailJob < ActiveJob::Base
queue_as :default
def perform(user)
@user = user
UserMailer.welcome_email(@user).deliver_later
end
end
它使用我的邮件:
class UserMailer < ActionMailer::Base
def welcome_email(user)
@user = user
mg_client = Mailgun::Client.
我在Azure的VM中使用Ubuntu14.04.4LTS (Trusty )上的GitLab Community 8.8.5 68cd138。
我在配置后缀时没有成功,所以我尝试在我的SendGrid帐户中使用SMTP。以前我很成功,但这次没有成功。当一个新用户为自己创建一个帐户时,我希望看到那个人收到一封电子邮件,但他们从未收到过这封电子邮件。
因此,我查看了/var/log/gitlab/gitlab-rails/production,并看到:
Started POST "/users" for 73.181.210.158 at 2016-06-18 03:45:55
在达到可配置的阈值后,我必须执行一些操作。让我来解释一下这个场景: 假设我在数据库中有以下配置: Time Action
---------------
5 min A1
10 min A2
20 min A3 我现在必须调度一个作业(可能在sidekiq中),以便: At 5th min - action A1 is triggered
At 10th min - action A2 is triggered
At 20th min - action A3 is triggered
Reset the timer
At 25th min - actio
我们在我们的应用程序中偶尔会看到超时,这似乎可以追溯到Redis,尽管我不能完全确定。我们在一些工作中包含了一个模块,以减少繁重工作的重复:
module UniqueEnqueable
require 'sidekiq/api'
extend ActiveSupport::Concern
included do
before_enqueue do |job|
throw(:abort) if already_queued_or_scheduled?(job.queue_name, job.arguments)
end
end
我在我的rails应用程序中使用了active_job。该工作目前有效,但部署到heroku时,我无法连接到Redis。在heroku,我有RedisToGo的副词。当推到heroku时,我会得到以下错误。
错误
/app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:331:in `rescue in establish_connection': Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) (Redis::CannotC
我正在为学生建立一个电子邮件提醒功能。他们应该在他们的导师指定的时间间隔内收到一封电子邮件,指出他们取得了多大的进步。
我的方法是使用ActiveJob来安排发送电子邮件的作业,然后在执行任务时,我使用after_perform回调来调度下一个作业(取自)。如下所示:
class StudentReminderJob < ApplicationJob
queue_as :default
after_perform do |job|
# (get user update frequency preference)
self.class.set(wait: upd
我正在使用经典的asp和IIS7进行开发。
当我在文本框中输入带有特殊字符( do )的文本并提交时。在服务器端代码上收到的特殊字符将变为一个菱形符号,其中带有问号。
已包含以下编码
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
在asp文件中。
我也试过用"Encode in UTF-8 without BOM“格式保存文件
而部署在开发服务器上的相同文件工作正常。特殊字符( on )在服务器端代码中保持不变。
我是不是错过了一些IIS7设置