百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

delayed_job_web

> 编程语言
开源

用于延迟作业的类似 Web 接口的 Resque

481 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于延迟作业的类似 Web 接口的 Resque

delayed_job_web

A resque inspired (read: stolen) interface for delayed_job. This gem is written to work with rails 3 and 4 applications using activerecord 3 and 4 but it is documented to also work with rails 5, 6 and 7.

Some features:

  • Easily view enqueued, working, pending, and failed jobs.
  • Queue any single job or all pending jobs to run immediately.
  • Remove a failed job or easily remove all failed jobs.
  • Watch delayed_job operation with live ajax polling.
  • Filter delayed_jobs by queue names (comma separated values in the input filter).
  • Reset all queue filters by clicking the reset button.

The interface (yeah, a ripoff of resque-web):

Quick Start For Rails versions 3 through 7 Applications

Add the dependency to your Gemfile

ruby
gem "delayed_job_web"

Install it...

ruby
bundle

Add the following route to your application for accessing the interface, and retrying failed jobs.

ruby
match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]

You probably want to password protect the interface, an easy way is to add something like this your config.ru file

ruby
if Rails.env.production?
  DelayedJobWeb.use Rack::Auth::Basic do |username, password|
    ActiveSupport::SecurityUtils.secure_compare('username', username) &&
      ActiveSupport::SecurityUtils.secure_compare('password', password)
  end
end

delayed_job_web runs as a Sinatra application within the rails application. Visit it at /delayed_job.

Authenticating with Devise and Warden

This can be accomplished in the routes.rb file using an authenticated callback. Note, do not use an authenticate callback as this forces an authentication check and redirects can be screwy, see here for more information.

A simple user check looks like this:

ruby

authenticated :user do
  mount DelayedJobWeb, at: "/delayed_job"
end

But you probably want to check for administrator permissions:

ruby

authenticated :user, -> user { user.admin? }  do
  mount DelayedJobWeb, at: "/delayed_job"
end

Serving static assets

If you mount the app on another route, you may encounter the CSS not working anymore. To work around this you can leverage a special HTTP header. Install it, activate it and configure it -- see below.

Apache

XSendFile On
XSendFilePath /path/to/shared/bundle

XSendFilePath white-lists a directory from which static files are allowed to be served. This should be at least the path to where delayed_job_web is installed.

Using Rails you'll have to set config.action_dispatch.x_sendfile_header = "X-Sendfile".

Nginx

Nginx uses an equivalent that's called X-Accel-Redirect, further instructions can be found in their wiki.

Rails' will need to be configured to config.action_dispatch.x_sendfile_header = "X-Accel-Redirect".

Lighttpd

Lighty is more X-Sendfile, like outlined in their wiki.

Configuration

The following settings can be changed using the .set method in your configu.ru. For example:

ruby
DelayedJobWeb.set(:allow_requeue_pending, false)
  • allow_requeue_pending (default: true)

    Controls whether the 'Enqueue all immediately' button is available on the list of Pending jobs. Hiding this button can be useful if you have jobs set to run in the future and you don't want to accidentally run them immediately.

Contributing

  1. Fork
  2. Hack
  3. rake test
  4. Send a pull request

Releasing a new version

  1. Update the version in delayed_job_web.gemspec

  2. git commit delayed_job_web.gemspec with the following message format:

     Version x.x.x
    
     Changelog:
     * Some new feature
     * Some new bug fix
  3. rake release

Author

Erick Schmitt - @ejschmitt

Maintained by Andy Atkinson - @andatki

Get in touch if you'd like to take over maintenance!

Issues· 36 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言