mhenrixon/sidekiq-unique-jobs

View on GitHub
doc/SidekiqUniqueJobs/Locksmith.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: SidekiqUniqueJobs::Locksmith
  
    &mdash; 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::Locksmith";
  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 (L)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span>
     &raquo; 
    <span class="title">Locksmith</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::Locksmith
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">SidekiqUniqueJobs::Locksmith</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  <dl>
      <dt>Includes:</dt>
      <dd><span class='object_link'><a href="Connection.html" title="SidekiqUniqueJobs::Connection (module)">Connection</a></span>, <span class='object_link'><a href="JSON.html" title="SidekiqUniqueJobs::JSON (module)">JSON</a></span>, <span class='object_link'><a href="Logging.html" title="SidekiqUniqueJobs::Logging (module)">Logging</a></span>, <span class='object_link'><a href="Reflectable.html" title="SidekiqUniqueJobs::Reflectable (module)">Reflectable</a></span>, <span class='object_link'><a href="Script/Caller.html" title="SidekiqUniqueJobs::Script::Caller (module)">Script::Caller</a></span>, <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/locksmith.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Lock manager class that handles all the various locks</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>
      Constant Summary
      <small><a href="#" class="constants_summary_toggle">collapse</a></small>
    </h2>

    <dl class="constants">
      
        <dt id="CLOCK_DRIFT_FACTOR-constant" class="">CLOCK_DRIFT_FACTOR =
          <div class="docstring">
  <div class="discussion">
    <p>Returns used to take into consideration the inaccuracy of redis timestamps.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>used to take into consideration the inaccuracy of redis timestamps</p>
</div>
      
    </li>
  
</ul>

</div>
        </dt>
        <dd><pre class="code"><span class='float'>0.01</span></pre></dd>
      
    </dl>
  




  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#config-instance_method" title="#config (instance method)">#<strong>config</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute config.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#item-instance_method" title="#item (instance method)">#<strong>item</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute item.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#job_id-instance_method" title="#job_id (instance method)">#<strong>job_id</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute job_id.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute key.</p>
</div></span>
  
</li>

    
  </ul>




  
    <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="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(other)  &#x21d2; true, false </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Compare this locksmith with another.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#build_message-instance_method" title="#build_message (instance method)">#<strong>build_message</strong>(message_or_exception, item = nil)  &#x21d2; String </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#build_message-instance_method" title="SidekiqUniqueJobs::Logging#build_message (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Build a log message.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Deletes the lock unless it has a pttl set.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete!-instance_method" title="#delete! (instance method)">#<strong>delete!</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Deletes the lock regardless of if it has a pttl set.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(&amp;block)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(item, redis_pool = nil)  &#x21d2; Locksmith </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Initialize a new Locksmith instance.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#lock-instance_method" title="#lock (instance method)">#<strong>lock</strong>(wait: nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Create a lock for the Sidekiq job.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#locked%3F-instance_method" title="#locked? (instance method)">#<strong>locked?</strong>(conn = nil)  &#x21d2; true, false </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Checks if this instance is considered locked.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_debug-instance_method" title="#log_debug (instance method)">#<strong>log_debug</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#log_debug-instance_method" title="SidekiqUniqueJobs::Logging#log_debug (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at debug level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_error-instance_method" title="#log_error (instance method)">#<strong>log_error</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#log_error-instance_method" title="SidekiqUniqueJobs::Logging#log_error (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at error level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_fatal-instance_method" title="#log_fatal (instance method)">#<strong>log_fatal</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#log_fatal-instance_method" title="SidekiqUniqueJobs::Logging#log_fatal (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at fatal level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_info-instance_method" title="#log_info (instance method)">#<strong>log_info</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#log_info-instance_method" title="SidekiqUniqueJobs::Logging#log_info (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at info level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_warn-instance_method" title="#log_warn (instance method)">#<strong>log_warn</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#log_warn-instance_method" title="SidekiqUniqueJobs::Logging#log_warn (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at warn level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#logger-instance_method" title="#logger (instance method)">#<strong>logger</strong>  &#x21d2; Logger </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#logger-instance_method" title="SidekiqUniqueJobs::Logging#logger (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A convenience method for using the configured gem logger.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#logging_context-instance_method" title="#logging_context (instance method)">#<strong>logging_context</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#logging_context-instance_method" title="SidekiqUniqueJobs::Logging#logging_context (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setup some variables to add to each log line.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#redis-instance_method" title="#redis (instance method)">#<strong>redis</strong>(r_pool = nil, &amp;block)  &#x21d2; Sidekiq::RedisConnection, ConnectionPool </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Connection.html#redis-instance_method" title="SidekiqUniqueJobs::Connection#redis (method)">Connection</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Creates a connection to redis.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#reflect-instance_method" title="#reflect (instance method)">#<strong>reflect</strong>(reflection, *args)  &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Reflectable.html#reflect-instance_method" title="SidekiqUniqueJobs::Reflectable#reflect (method)">Reflectable</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reflects on specific event.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Nicely formatted string with information about self.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#unlock-instance_method" title="#unlock (instance method)">#<strong>unlock</strong>(conn = nil)  &#x21d2; false, String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Removes the lock keys from Redis if locked by the provided jid/token.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#unlock!-instance_method" title="#unlock! (instance method)">#<strong>unlock!</strong>(conn = nil)  &#x21d2; false, String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Removes the lock keys from Redis.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#with_configured_loggers_context-instance_method" title="#with_configured_loggers_context (instance method)">#<strong>with_configured_loggers_context</strong> { ... } &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#with_configured_loggers_context-instance_method" title="SidekiqUniqueJobs::Logging#with_configured_loggers_context (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Attempt to setup context aware logging for the given logger.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#with_logging_context-instance_method" title="#with_logging_context (instance method)">#<strong>with_logging_context</strong>  &#x21d2; void </a>
    

    
  </span>
  
    <span class="note title not_defined_here">
      included
      from <span class='object_link'><a href="Logging.html#with_logging_context-instance_method" title="SidekiqUniqueJobs::Logging#with_logging_context (method)">Logging</a></span>
    </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Wraps the middleware logic with context aware logging.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  
  
  
  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>(item, redis_pool = nil)  &#x21d2; <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::Locksmith (class)">Locksmith</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Initialize a new Locksmith instance</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>item</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>a Sidekiq job hash</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>redis_pool</span>
      
      
        <span class='type'>(<tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the redis connection</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>item</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:lock_ttl</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>the configured expiration</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:jid</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>the sidekiq job id</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:unique_digest</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>the unique digest (See: <span class='object_link'><a href="LockDigest.html#lock_digest-instance_method" title="SidekiqUniqueJobs::LockDigest#lock_digest (method)">SidekiqUniqueJobs::LockDigest#lock_digest</a></span>)</p>
</div>
          
        </li>
      
    </ul>
  
    
    


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


62
63
64
65
66
67
68</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 62</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_redis_pool'>redis_pool</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='ivar'>@item</span>        <span class='op'>=</span> <span class='id identifier rubyid_item'>item</span>
  <span class='ivar'>@key</span>         <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Key.html" title="SidekiqUniqueJobs::Key (class)">Key</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Key.html#initialize-instance_method" title="SidekiqUniqueJobs::Key#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_DIGEST-constant" title="SidekiqUniqueJobs::LOCK_DIGEST (constant)">LOCK_DIGEST</a></span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#UNIQUE_DIGEST-constant" title="SidekiqUniqueJobs::UNIQUE_DIGEST (constant)">UNIQUE_DIGEST</a></span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='comment'># fallback until can be removed
</span>  <span class='ivar'>@job_id</span>      <span class='op'>=</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='ivar'>@config</span>      <span class='op'>=</span> <span class='const'><span class='object_link'><a href="LockConfig.html" title="SidekiqUniqueJobs::LockConfig (class)">LockConfig</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="LockConfig.html#initialize-instance_method" title="SidekiqUniqueJobs::LockConfig#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='ivar'>@redis_pool</span>  <span class='op'>=</span> <span class='id identifier rubyid_redis_pool'>redis_pool</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="config-instance_method">
  
    #<strong>config</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute config.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


47
48
49</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 47</span>

<span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
  <span class='ivar'>@config</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="item-instance_method">
  
    #<strong>item</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute item.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


51
52
53</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 51</span>

<span class='kw'>def</span> <span class='id identifier rubyid_item'>item</span>
  <span class='ivar'>@item</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="job_id-instance_method">
  
    #<strong>job_id</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute job_id.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 43</span>

<span class='kw'>def</span> <span class='id identifier rubyid_job_id'>job_id</span>
  <span class='ivar'>@job_id</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="key-instance_method">
  
    #<strong>key</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute key.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


39
40
41</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 39</span>

<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
  <span class='ivar'>@key</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </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="==-instance_method">
  
    #<strong>==</strong>(other)  &#x21d2; <tt>true</tt>, <tt>false</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Compare this locksmith with another</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>other</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::Locksmith (class)">Locksmith</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the locksmith to compare with</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


171
172
173</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 171</span>

<span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_key'>key</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_job_id'>job_id</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_job_id'>job_id</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="build_message-instance_method">
  
    #<strong>build_message</strong>(message_or_exception, item = nil)  &#x21d2; <tt>String</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#build_message-instance_method" title="SidekiqUniqueJobs::Logging#build_message (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p>Build a log message</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>an entry to log</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>item</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the sidekiq job hash</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>a complete log entry</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete-instance_method">
  
    #<strong>delete</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Deletes the lock unless it has a pttl set</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


74
75
76
77
78</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 74</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
  <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_pttl'>pttl</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>

  <span class='id identifier rubyid_delete!'>delete!</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete!-instance_method">
  
    #<strong>delete!</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Deletes the lock regardless of if it has a pttl set</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


83
84
85</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 83</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete!'>delete!</span>
  <span class='id identifier rubyid_call_script'>call_script</span><span class='lparen'>(</span><span class='symbol'>:delete</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_pttl'>pttl</span><span class='comma'>,</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_limit'>limit</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="execute-instance_method">
  
    #<strong>execute</strong>(&amp;block)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="InvalidArgument.html" title="SidekiqUniqueJobs::InvalidArgument (class)">SidekiqUniqueJobs::InvalidArgument</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


101
102
103
104
105
106
107</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 101</span>

<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="InvalidArgument.html" title="SidekiqUniqueJobs::InvalidArgument (class)">InvalidArgument</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>#execute needs a block</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>

  <span class='id identifier rubyid_redis'>redis</span><span class='lparen'>(</span><span class='id identifier rubyid_redis_pool'>redis_pool</span><span class='rparen'>)</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_lock!'>lock!</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span><span class='comma'>,</span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:primed_async</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="inspect-instance_method">
  
    #<strong>inspect</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="#to_s-instance_method" title="SidekiqUniqueJobs::Locksmith#to_s (method)">#to_s</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


160
161
162</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 160</span>

<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
  <span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="lock-instance_method">
  
    #<strong>lock</strong>(wait: nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Create a lock for the Sidekiq job</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the Sidekiq job_id that was locked/queued</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


92
93
94
95
96
97
98
99</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 92</span>

<span class='kw'>def</span> <span class='id identifier rubyid_lock'>lock</span><span class='lparen'>(</span><span class='label'>wait:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_method_name'>method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_wait'>wait</span> <span class='op'>?</span> <span class='symbol'>:primed_async</span> <span class='op'>:</span> <span class='symbol'>:primed_sync</span>
  <span class='id identifier rubyid_redis'>redis</span><span class='lparen'>(</span><span class='id identifier rubyid_redis_pool'>redis_pool</span><span class='rparen'>)</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_lock!'>lock!</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span><span class='comma'>,</span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method_name'>method_name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_wait'>wait</span><span class='rparen'>)</span> <span class='kw'>do</span>
      <span class='kw'>return</span> <span class='id identifier rubyid_job_id'>job_id</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="locked?-instance_method">
  
    #<strong>locked?</strong>(conn = nil)  &#x21d2; <tt>true</tt>, <tt>false</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Checks if this instance is considered locked</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>conn</span>
      
      
        <span class='type'>(<tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the redis connection</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>true when the :LOCKED hash contains the job_id</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


141
142
143
144
145</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 141</span>

<span class='kw'>def</span> <span class='id identifier rubyid_locked?'>locked?</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_taken?'>taken?</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_conn'>conn</span>

  <span class='id identifier rubyid_redis'>redis</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_rcon'>rcon</span><span class='op'>|</span> <span class='id identifier rubyid_taken?'>taken?</span><span class='lparen'>(</span><span class='id identifier rubyid_rcon'>rcon</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_debug-instance_method">
  
    #<strong>log_debug</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#log_debug-instance_method" title="SidekiqUniqueJobs::Logging#log_debug (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at debug level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_error-instance_method">
  
    #<strong>log_error</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#log_error-instance_method" title="SidekiqUniqueJobs::Logging#log_error (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at error level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_fatal-instance_method">
  
    #<strong>log_fatal</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#log_fatal-instance_method" title="SidekiqUniqueJobs::Logging#log_fatal (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at fatal level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_info-instance_method">
  
    #<strong>log_info</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#log_info-instance_method" title="SidekiqUniqueJobs::Logging#log_info (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at info level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_warn-instance_method">
  
    #<strong>log_warn</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#log_warn-instance_method" title="SidekiqUniqueJobs::Logging#log_warn (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at warn level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="logger-instance_method">
  
    #<strong>logger</strong>  &#x21d2; <tt>Logger</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#logger-instance_method" title="SidekiqUniqueJobs::Logging#logger (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p>A convenience method for using the configured gem logger</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Logger</tt>)</span>
      
      
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li>SidekiqUniqueJobs#.logger</li>
    
  </ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="logging_context-instance_method">
  
    #<strong>logging_context</strong>  &#x21d2; <tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#logging_context-instance_method" title="SidekiqUniqueJobs::Logging#logging_context (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setup some variables to add to each log line</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the context to use for each log line</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>NotImplementedError</tt>)</span>
      
      
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="redis-instance_method">
  
    #<strong>redis</strong>(r_pool = nil, &amp;block)  &#x21d2; <tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Connection.html#redis-instance_method" title="SidekiqUniqueJobs::Connection#redis (method)">Connection</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p>Creates a connection to redis</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>a connection to redis</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="reflect-instance_method">
  
    #<strong>reflect</strong>(reflection, *args)  &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Reflectable.html#reflect-instance_method" title="SidekiqUniqueJobs::Reflectable#reflect (method)">Reflectable</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Reflects on specific event</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>reflection</span>
      
      
        <span class='type'>(<tt>Symbol</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the reflected event</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>args</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>arguments to provide to reflector</p>
</div>
      
    </li>
  
</ul>


</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_s-instance_method">
  
    #<strong>to_s</strong>  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Nicely formatted string with information about self</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


153
154
155</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 153</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Locksmith#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object_id'>object_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>(digest=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'> job_id=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_job_id'>job_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> locked=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_locked?'>locked?</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="unlock-instance_method">
  
    #<strong>unlock</strong>(conn = nil)  &#x21d2; <tt>false</tt>, <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Removes the lock keys from Redis if locked by the provided jid/token</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>unless locked?</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Sidekiq job_id (jid) if successful</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 115</span>

<span class='kw'>def</span> <span class='id identifier rubyid_unlock'>unlock</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_locked?'>locked?</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span><span class='rparen'>)</span>

  <span class='id identifier rubyid_unlock!'>unlock!</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="unlock!-instance_method">
  
    #<strong>unlock!</strong>(conn = nil)  &#x21d2; <tt>false</tt>, <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Removes the lock keys from Redis</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>unless locked?</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Sidekiq job_id (jid) if successful</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


127
128
129
130
131
132
133</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/locksmith.rb', line 127</span>

<span class='kw'>def</span> <span class='id identifier rubyid_unlock!'>unlock!</span><span class='lparen'>(</span><span class='id identifier rubyid_conn'>conn</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_call_script'>call_script</span><span class='lparen'>(</span><span class='symbol'>:unlock</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='comma'>,</span> <span class='id identifier rubyid_argv'>argv</span><span class='comma'>,</span> <span class='id identifier rubyid_conn'>conn</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_unlocked_jid'>unlocked_jid</span><span class='op'>|</span>
    <span class='id identifier rubyid_reflect'>reflect</span><span class='lparen'>(</span><span class='symbol'>:debug</span><span class='comma'>,</span> <span class='symbol'>:unlocked</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_unlocked_jid'>unlocked_jid</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_unlocked_jid'>unlocked_jid</span> <span class='op'>==</span> <span class='id identifier rubyid_job_id'>job_id</span>

    <span class='id identifier rubyid_unlocked_jid'>unlocked_jid</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="with_configured_loggers_context-instance_method">
  
    #<strong>with_configured_loggers_context</strong> { ... } &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#with_configured_loggers_context-instance_method" title="SidekiqUniqueJobs::Logging#with_configured_loggers_context (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Attempt to setup context aware logging for the given logger</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
    </li>
  
</ul>

</div>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="with_logging_context-instance_method">
  
    #<strong>with_logging_context</strong>  &#x21d2; <tt>void</tt> 
  

  

  
    <span class="not_defined_here">
      Originally defined in module
        <span class='object_link'><a href="Logging.html#with_logging_context-instance_method" title="SidekiqUniqueJobs::Logging#with_logging_context (method)">Logging</a></span>
    </span>
  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Wraps the middleware logic with context aware logging</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
  
    <li>
      
      
        <span class='type'>(<tt>void</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>yield to the middleware instance</p>
</div>
      
    </li>
  
</ul>

</div>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Mon Sep 27 15:29:07 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>