Class: Resque::JobsController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
ActionController::ConditionalGet
Defined in:
app/controllers/resque/jobs_controller.rb

Constant Summary collapse

JOB_ID_PATTERN =
/([a-f0-9]{32})/

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/resque/jobs_controller.rb', line 7

def show
  unless meta
    self.status = 404
    self.content_type = "application/json; charset=utf-8"
    self.response_body = '{"message":"not found"}'
    return
  end

  data = {
    enqueued_at: meta.enqueued_at,
    started_at: meta.started_at,
    finished_at: meta.finished_at,
    succeeded: meta.succeeded?,
    failed: meta.failed?,
    progress: meta.progress,
    payload: meta['payload']
  }

  self.status = 200
  self.content_type = "application/json; charset=utf-8"
  self.response_body = MultiJson.dump(data)
  expires_now
end