doc/SidekiqUniqueJobs/OnConflict/Reject.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: SidekiqUniqueJobs::OnConflict::Reject
— Documentation by YARD 0.9.26
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "SidekiqUniqueJobs::OnConflict::Reject";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (R)</a> »
<span class='title'><span class='object_link'><a href="../../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span> » <span class='title'><span class='object_link'><a href="../OnConflict.html" title="SidekiqUniqueJobs::OnConflict (module)">OnConflict</a></span></span>
»
<span class="title">Reject</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Class: SidekiqUniqueJobs::OnConflict::Reject
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName"><span class='object_link'><a href="Strategy.html" title="SidekiqUniqueJobs::OnConflict::Strategy (class)">Strategy</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="Strategy.html" title="SidekiqUniqueJobs::OnConflict::Strategy (class)">Strategy</a></span></li>
<li class="next">SidekiqUniqueJobs::OnConflict::Reject</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Includes:</dt>
<dd><span class='object_link'><a href="../Timing.html" title="SidekiqUniqueJobs::Timing (module)">Timing</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/on_conflict/reject.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Strategy to send jobs to dead queue</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Author:</p>
<ul class="author">
<li>
<div class='inline'><p>Mikael Henriksson <a href="mailto:mikael@mhenrixon.com">mikael@mhenrixon.com</a></p>
</div>
</li>
</ul>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Send jobs to dead queue.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#deadset-instance_method" title="#deadset (instance method)">#<strong>deadset</strong> ⇒ Sidekiq::Deadset </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>An instance of Sidekiq::Deadset.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#deadset_kill-instance_method" title="#deadset_kill (instance method)">#<strong>deadset_kill</strong> ⇒ void </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>Use Sidekiqs built in Sidekiq::DeadSet#kill to get rid of the job.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#deadset_kill%3F-instance_method" title="#deadset_kill? (instance method)">#<strong>deadset_kill?</strong> ⇒ true, false </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>Sidekiq version compatibility check.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#kill_job_with_options-instance_method" title="#kill_job_with_options (instance method)">#<strong>kill_job_with_options</strong> ⇒ void </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>Executes the kill instructions with arguments.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#kill_job_without_options-instance_method" title="#kill_job_without_options (instance method)">#<strong>kill_job_without_options</strong> ⇒ void </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>Executes the kill instructions without arguments.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#kill_with_options%3F-instance_method" title="#kill_with_options? (instance method)">#<strong>kill_with_options?</strong> ⇒ true, false </a>
</span>
<span class="private note title">private</span>
<span class="summary_desc"><div class='inline'><p>Sidekiq version compatibility check.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#payload-instance_method" title="#payload (instance method)">#<strong>payload</strong> ⇒ String </a>
</span>
<span class="summary_desc"><div class='inline'><p>The Sidekiq job hash as JSON.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#push_to_deadset-instance_method" title="#push_to_deadset (instance method)">#<strong>push_to_deadset</strong> ⇒ void </a>
</span>
<span class="summary_desc"><div class='inline'><p>Used for compatibility with older Sidekiq versions.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Strategy.html#initialize-instance_method" title="SidekiqUniqueJobs::OnConflict::Strategy#initialize (method)">SidekiqUniqueJobs::OnConflict::Strategy</a></span></p>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="call-instance_method">
#<strong>call</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Send jobs to dead queue</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
12
13
14
15
16
17
18
19
20</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 12</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
<span class='id identifier rubyid_log_info'>log_info</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Adding dead </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../../SidekiqUniqueJobs.html#CLASS-constant" title="SidekiqUniqueJobs::CLASS (constant)">CLASS</a></span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> job </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../../SidekiqUniqueJobs.html#JID-constant" title="SidekiqUniqueJobs::JID (constant)">JID</a></span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span>
<span class='kw'>if</span> <span class='id identifier rubyid_deadset_kill?'>deadset_kill?</span>
<span class='id identifier rubyid_deadset_kill'>deadset_kill</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_push_to_deadset'>push_to_deadset</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="deadset-instance_method">
#<strong>deadset</strong> ⇒ <tt>Sidekiq::Deadset</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p>An instance of Sidekiq::Deadset</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Sidekiq::Deadset</tt>)</span>
—
<div class='inline'><blockquote>
</blockquote>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
87
88
89</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 87</span>
<span class='kw'>def</span> <span class='id identifier rubyid_deadset'>deadset</span>
<span class='ivar'>@deadset</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="../../Sidekiq.html" title="Sidekiq (module)">Sidekiq</a></span></span><span class='op'>::</span><span class='const'>DeadSet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="deadset_kill-instance_method">
#<strong>deadset_kill</strong> ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p class="note returns_void">This method returns an undefined value.</p><p>Use Sidekiqs built in Sidekiq::DeadSet#kill
to get rid of the job</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
41
42
43
44
45
46
47</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 41</span>
<span class='kw'>def</span> <span class='id identifier rubyid_deadset_kill'>deadset_kill</span>
<span class='kw'>if</span> <span class='id identifier rubyid_kill_with_options?'>kill_with_options?</span>
<span class='id identifier rubyid_kill_job_with_options'>kill_job_with_options</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_kill_job_without_options'>kill_job_without_options</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="deadset_kill?-instance_method">
#<strong>deadset_kill?</strong> ⇒ <tt>true</tt>, <tt>false</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p>Sidekiq version compatibility check</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
—
<div class='inline'><p>depending on if Sidekiq::Deadset responds to kill</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
29
30
31</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 29</span>
<span class='kw'>def</span> <span class='id identifier rubyid_deadset_kill?'>deadset_kill?</span>
<span class='id identifier rubyid_deadset'>deadset</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:kill</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="kill_job_with_options-instance_method">
#<strong>kill_job_with_options</strong> ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p class="note returns_void">This method returns an undefined value.</p><p>Executes the kill instructions with arguments</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
77
78
79</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 77</span>
<span class='kw'>def</span> <span class='id identifier rubyid_kill_job_with_options'>kill_job_with_options</span>
<span class='id identifier rubyid_deadset'>deadset</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='comma'>,</span> <span class='label'>notify_failure:</span> <span class='kw'>false</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="kill_job_without_options-instance_method">
#<strong>kill_job_without_options</strong> ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p class="note returns_void">This method returns an undefined value.</p><p>Executes the kill instructions without arguments</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 67</span>
<span class='kw'>def</span> <span class='id identifier rubyid_kill_job_without_options'>kill_job_without_options</span>
<span class='id identifier rubyid_deadset'>deadset</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="kill_with_options?-instance_method">
#<strong>kill_with_options?</strong> ⇒ <tt>true</tt>, <tt>false</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note private">
<strong>This method is part of a private API.</strong>
You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>
<p>Sidekiq version compatibility check</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>)</span>
—
<div class='inline'><p>when Sidekiq::Deadset#kill takes more than 1 argument</p>
</div>
</li>
<li>
<span class='type'>(<tt>false</tt>)</span>
—
<div class='inline'><p>when Sidekiq::Deadset#kill does not take multiple arguments</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 57</span>
<span class='kw'>def</span> <span class='id identifier rubyid_kill_with_options?'>kill_with_options?</span>
<span class='const'><span class='object_link'><a href="../../Sidekiq.html" title="Sidekiq (module)">Sidekiq</a></span></span><span class='op'>::</span><span class='const'>DeadSet</span><span class='period'>.</span><span class='id identifier rubyid_instance_method'>instance_method</span><span class='lparen'>(</span><span class='symbol'>:kill</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>></span> <span class='int'>1</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="payload-instance_method">
#<strong>payload</strong> ⇒ <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>The Sidekiq job hash as JSON</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a JSON formatted string</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
113
114
115</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 113</span>
<span class='kw'>def</span> <span class='id identifier rubyid_payload'>payload</span>
<span class='ivar'>@payload</span> <span class='op'>||=</span> <span class='id identifier rubyid_dump_json'>dump_json</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="push_to_deadset-instance_method">
#<strong>push_to_deadset</strong> ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note returns_void">This method returns an undefined value.</p><p>Used for compatibility with older Sidekiq versions</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
97
98
99
100
101
102
103
104
105</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/on_conflict/reject.rb', line 97</span>
<span class='kw'>def</span> <span class='id identifier rubyid_push_to_deadset'>push_to_deadset</span>
<span class='id identifier rubyid_redis'>redis</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_conn'>conn</span><span class='op'>|</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_multi'>multi</span> <span class='kw'>do</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zadd'>zadd</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dead</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span><span class='comma'>,</span> <span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zremrangebyscore'>zremrangebyscore</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dead</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-inf</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span> <span class='op'>-</span> <span class='const'><span class='object_link'><a href="../../Sidekiq.html" title="Sidekiq (module)">Sidekiq</a></span></span><span class='op'>::</span><span class='const'>DeadSet</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zremrangebyrank'>zremrangebyrank</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dead</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>-</span><span class='const'><span class='object_link'><a href="../../Sidekiq.html" title="Sidekiq (module)">Sidekiq</a></span></span><span class='op'>::</span><span class='const'>DeadSet</span><span class='period'>.</span><span class='id identifier rubyid_max_jobs'>max_jobs</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Sep 27 15:29:09 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
</div>
</body>
</html>