10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/webhookdb/async/job_logger.rb', line 10
def self.durable_job_failure_notifier(job)
job = job.dup
jargs = job.delete("args")
jcls = job.delete("class")
jid = job.delete("jid")
jq = job.delete("queue")
jcreated = job.delete("created_at")
safe_fields = [
{title: "Job ID", value: jid, short: true},
{title: "Job Class", value: "`#{jcls}`", short: true},
{title: "Args", value: "```#{jargs.to_json}```"},
{title: "Queue", value: jq, short: true},
{title: "Created At", value: self._ts("created_at", jcreated), short: true},
]
other_fields = job.compact.
map { |k, v| {title: k.humanize, value: self._ts(k, v), short: true} }
Webhookdb::DeveloperAlert.new(
subsystem: "Job Died",
emoji: ":zombie:",
fallback: "Job #{jcls}[#{jid}][#{jargs}] moved to DeadSet",
fields: safe_fields + other_fields,
).emit
end
|