rschmukler/agenda

View on GitHub
docs/agenda/4.0.1/job_touch.js.html

Summary

Maintainability
Test Coverage


<!DOCTYPE html>
<html lang="en">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>
      job/touch.js - Documentation
  </title>

  <link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">

  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

  <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  

  

  <!-- start Mixpanel -->
  <script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
  0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
  for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
  mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
  <!-- end Mixpanel -->
</head>

<body>
  <svg style="display: none;">
    <defs>
      <symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
          <path d="M0 0h24v24H0z" fill="none"/>
          <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
      </symbol>
    </defs>
  </svg>

  <input type="checkbox" id="nav-trigger" class="nav-trigger" />
  <label for="nav-trigger" class="navicon-button x">
    <div class="navicon"></div>
  </label>

  <label for="nav-trigger" class="overlay"></label>

  <div class="top-nav-wrapper">
    <ul>
      <li >
        <a href="index.html">
          
            <svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
              <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
              <path d="M0 0h24v24H0z" fill="none"/>
            </svg>
          
          
        </a>
      </li>

      

    </ul>
  </div>

  <nav>
    <h3 class="reference-title">
      Agenda
    </h3>

    

    <h3>Classes</h3><ul><li id="Agenda-nav"><a href="Agenda.html">Agenda</a><ul class='methods'><li data-type="method" id="Agenda-cancel-nav"><a href="Agenda.html#cancel">cancel</a></li><li data-type="method" id="Agenda-close-nav"><a href="Agenda.html#close">close</a></li><li data-type="method" id="Agenda-create-nav"><a href="Agenda.html#create">create</a></li><li data-type="method" id="Agenda-database-nav"><a href="Agenda.html#database">database</a></li><li data-type="method" id="Agenda-dbInit-nav"><a href="Agenda.html#dbInit">dbInit</a></li><li data-type="method" id="Agenda-defaultConcurrency-nav"><a href="Agenda.html#defaultConcurrency">defaultConcurrency</a></li><li data-type="method" id="Agenda-defaultLockLifetime-nav"><a href="Agenda.html#defaultLockLifetime">defaultLockLifetime</a></li><li data-type="method" id="Agenda-defaultLockLimit-nav"><a href="Agenda.html#defaultLockLimit">defaultLockLimit</a></li><li data-type="method" id="Agenda-define-nav"><a href="Agenda.html#define">define</a></li><li data-type="method" id="Agenda-every-nav"><a href="Agenda.html#every">every</a></li><li data-type="method" id="Agenda-findAndLockNextJob-nav"><a href="Agenda.html#findAndLockNextJob">findAndLockNextJob</a></li><li data-type="method" id="Agenda-jobs-nav"><a href="Agenda.html#jobs">jobs</a></li><li data-type="method" id="Agenda-locklimit-nav"><a href="Agenda.html#locklimit">locklimit</a></li><li data-type="method" id="Agenda-maxConcurrency-nav"><a href="Agenda.html#maxConcurrency">maxConcurrency</a></li><li data-type="method" id="Agenda-mongo-nav"><a href="Agenda.html#mongo">mongo</a></li><li data-type="method" id="Agenda-name-nav"><a href="Agenda.html#name">name</a></li><li data-type="method" id="Agenda-now-nav"><a href="Agenda.html#now">now</a></li><li data-type="method" id="Agenda-processEvery-nav"><a href="Agenda.html#processEvery">processEvery</a></li><li data-type="method" id="Agenda-purge-nav"><a href="Agenda.html#purge">purge</a></li><li data-type="method" id="Agenda-saveJob-nav"><a href="Agenda.html#saveJob">saveJob</a></li><li data-type="method" id="Agenda-schedule-nav"><a href="Agenda.html#schedule">schedule</a></li><li data-type="method" id="Agenda-sort-nav"><a href="Agenda.html#sort">sort</a></li><li data-type="method" id="Agenda-start-nav"><a href="Agenda.html#start">start</a></li><li data-type="method" id="Agenda-stop-nav"><a href="Agenda.html#stop">stop</a></li></ul></li><li id="Job-nav"><a href="Job.html">Job</a><ul class='methods'><li data-type="method" id="Job-computeNextRunAt-nav"><a href="Job.html#computeNextRunAt">computeNextRunAt</a></li><li data-type="method" id="Job-disable-nav"><a href="Job.html#disable">disable</a></li><li data-type="method" id="Job-enable-nav"><a href="Job.html#enable">enable</a></li><li data-type="method" id="Job-fail-nav"><a href="Job.html#fail">fail</a></li><li data-type="method" id="Job-isRunning-nav"><a href="Job.html#isRunning">isRunning</a></li><li data-type="method" id="Job-remove-nav"><a href="Job.html#remove">remove</a></li><li data-type="method" id="Job-repeatAt-nav"><a href="Job.html#repeatAt">repeatAt</a></li><li data-type="method" id="Job-repeatEvery-nav"><a href="Job.html#repeatEvery">repeatEvery</a></li><li data-type="method" id="Job-run-nav"><a href="Job.html#run">run</a></li><li data-type="method" id="Job-schedule-nav"><a href="Job.html#schedule">schedule</a></li><li data-type="method" id="Job-toJSON-nav"><a href="Job.html#toJSON">toJSON</a></li><li data-type="method" id="Job-touch-nav"><a href="Job.html#touch">touch</a></li><li data-type="method" id="Job-unique-nav"><a href="Job.html#unique">unique</a></li></ul></li><li id="JobProcessingQueue-nav"><a href="JobProcessingQueue.html">JobProcessingQueue</a><ul class='methods'><li data-type="method" id="JobProcessingQueue-insert-nav"><a href="JobProcessingQueue.html#insert">insert</a></li><li data-type="method" id="JobProcessingQueue-pop-nav"><a href="JobProcessingQueue.html#pop">pop</a></li><li data-type="method" id="JobProcessingQueue-push-nav"><a href="JobProcessingQueue.html#push">push</a></li><li data-type="method" id="JobProcessingQueue-returnNextConcurrencyFreeJob-nav"><a href="JobProcessingQueue.html#returnNextConcurrencyFreeJob">returnNextConcurrencyFreeJob</a></li></ul></li></ul><h3 id="global-nav">Global</h3><ul><li><a href="global.html#createJob">createJob</a></li><li><a href="global.html#hasMongoProtocol">hasMongoProtocol</a></li><li><a href="global.html#parsePriority">parsePriority</a></li><li><a href="global.html#priority">priority</a></li><li><a href="global.html#processJobs">processJobs</a></li></ul>
  </nav>

  <div id="main">
    
      <h1 class="page-title">
        job/touch.js
      </h1>
    

    
      

<section>
  <article>
    <pre class="prettyprint source linenums"><code>"use strict";
var __awaiter = (this &amp;&amp; this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this &amp;&amp; this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] &amp; 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" &amp;&amp; (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y &amp;&amp; (t = op[0] &amp; 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) &amp;&amp; t.call(y), 0) : y.next) &amp;&amp; !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] &amp; 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 &amp;&amp; t[t.length - 1]) &amp;&amp; (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 &amp;&amp; (!t || (op[1] > t[0] &amp;&amp; op[1] &lt; t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 &amp;&amp; _.label &lt; t[1]) { _.label = t[1]; t = op; break; }
                    if (t &amp;&amp; _.label &lt; t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] &amp; 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.touch = void 0;
/**
 * Updates "lockedAt" time so the job does not get picked up again
 * @name Job#touch
 * @function
 */
var touch = function () {
    return __awaiter(this, void 0, void 0, function () {
        return __generator(this, function (_a) {
            this.attrs.lockedAt = new Date();
            return [2 /*return*/, this.save()];
        });
    });
};
exports.touch = touch;
</code></pre>
  </article>
</section>

    


  </div>

  <br class="clear">

  <footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a>
  </footer>

  <script src="scripts/linenumber.js"></script>
  <script src="scripts/pagelocation.js"></script>

  

</body>
</html>