我正在尝试做以下工作:
在数据库表bdrd_job_queue.中,
我所做的:
我的backgroundRB.yml文件中每15分钟就有一个时间表
方法调用有一个persistent_job.finish!调用,但它不起作用,因为persistent_job对象是零。
如何确保它已登录到DB中,但仍然自动从backgroundRB.yml调度?
发布于 2009-11-06 18:00:00
我终于能做到了。
解决方法是调度一个任务,该任务将将其排队到数据库中,计划立即运行。
你的工人..。
class NotificationWorker < BackgrounDRb::MetaWorker
set_worker_name :notification_worker
def create(args = nil)
end
def queue_notify_changes(args = nil)
BdrbJobQueue.insert_job(:worker_name => 'notification_worker',
:worker_method => 'notify_new_changes_DAEMON',
:args => 'hello_world',
:scheduled_at => Time.now.utc,
:job_key => 'email_changes_notification_task')
end
def notify_new_changes_DAEMON
#Do Incredibly cool stuff here
end在配置文件backgroundrb.yml中
---
:backgroundrb:
:ip: 0.0.0.0
:port: 11006
:environment: production
:log: foreground
:debug_log: true
:persistent_disabled: false
:persistent_delay: 10
:schedules:
:notification_worker:
:queue_notify_changes:
:trigger_args: 0 0 0 * * *https://stackoverflow.com/questions/1647592
复制相似问题