better-lock 2.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/prettier.xml +1 -0
- package/README.md +55 -41
- package/dist/better_lock.js +38 -35
- package/dist/better_lock.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.js +11 -12
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internals.js +2 -2
- package/dist/internals.js.map +1 -1
- package/dist/options.d.ts +17 -0
- package/dist/types.d.ts +1 -1
- package/docs/assets/highlight.css +3 -3
- package/docs/assets/main.js +4 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +424 -538
- package/docs/classes/BetterLockError.html +109 -5
- package/docs/classes/BetterLockExecutionTimeoutError.html +122 -5
- package/docs/classes/BetterLockInternalError.html +101 -5
- package/docs/classes/BetterLockInvalidArgumentError.html +112 -5
- package/docs/classes/BetterLockJobAbortedError.html +115 -5
- package/docs/classes/BetterLockQueueOverflowError.html +142 -5
- package/docs/classes/BetterLockWaitTimeoutError.html +122 -5
- package/docs/classes/_internal_.BetterLock.html +297 -65
- package/docs/classes/_internal_.KeyQueue.html +126 -7
- package/docs/classes/_internal_.LockJob.html +225 -27
- package/docs/index.html +83 -13
- package/docs/interfaces/BetterLockJobOptions.html +89 -9
- package/docs/interfaces/BetterLockOptions.html +149 -17
- package/docs/modules/_internal_.__home_panta_dev_pantas_better_lock_src_errors_.html +80 -1
- package/docs/modules/_internal_.html +68 -7
- package/docs/modules.html +96 -5
- package/docs/types/BetterLockErrorName.html +61 -0
- package/docs/types/BetterLockExecutor.html +63 -0
- package/docs/types/BetterLockKey.html +61 -0
- package/docs/types/BetterLockQueueEjectionStrategy.html +59 -0
- package/docs/types/_internal_.ICallback.html +59 -0
- package/docs/types/_internal_.ICallbackExecutor.html +73 -0
- package/docs/types/_internal_.IErrorExports.html +52 -0
- package/docs/types/_internal_.IPromiseExecutor.html +65 -0
- package/docs/variables/BetterLock.html +59 -0
- package/package.json +6 -6
- package/spec/better_lock.spec.ts +97 -1
- package/src/better_lock.ts +33 -28
- package/src/errors.ts +5 -2
- package/src/index.ts +2 -1
- package/src/options.ts +22 -0
- package/src/types.ts +2 -2
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
package/docs/index.html
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>better-lock</title><meta name="description" content="Documentation for better-lock"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.
|
|
1
|
+
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>better-lock</title><meta name="description" content="Documentation for better-lock"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base=".">
|
|
4
|
+
<div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<ul class="results">
|
|
6
|
+
<li class="state loading">Preparing search index...</li>
|
|
7
|
+
<li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">better-lock</a></div>
|
|
8
|
+
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
9
|
+
<div class="container container-main">
|
|
10
|
+
<div class="col-8 col-content">
|
|
11
|
+
<div class="tsd-page-title">
|
|
12
|
+
<h2>better-lock</h2></div>
|
|
13
|
+
<div class="tsd-panel tsd-typography">
|
|
2
14
|
<a href="#better-lock" id="better-lock" style="color: inherit; text-decoration: none;">
|
|
3
15
|
<h1>Better Lock</h1>
|
|
4
16
|
</a>
|
|
5
17
|
<p>A (better) node.js lock library.</p>
|
|
6
|
-
<p><img src="https://travis-ci.org/panta82/better-lock.svg?branch=master" alt="Travis tests"></p>
|
|
7
18
|
|
|
8
19
|
<a href="#features" id="features" style="color: inherit; text-decoration: none;">
|
|
9
20
|
<h3>Features</h3>
|
|
@@ -28,34 +39,35 @@
|
|
|
28
39
|
<pre><code class="language-bash"><span class="hl-0">npm install --save better-lock</span><br/><span class="hl-1"># or</span><br/><span class="hl-0">yarn add better-lock</span>
|
|
29
40
|
</code></pre>
|
|
30
41
|
|
|
31
|
-
<a href="#
|
|
32
|
-
<h3>
|
|
42
|
+
<a href="#documentation" id="documentation" style="color: inherit; text-decoration: none;">
|
|
43
|
+
<h3>Documentation</h3>
|
|
33
44
|
</a>
|
|
45
|
+
<p>Full docs: <a href="https://panta82.github.io/better-lock/">https://panta82.github.io/better-lock/</a></p>
|
|
34
46
|
|
|
35
47
|
<a href="#minimal-example" id="minimal-example" style="color: inherit; text-decoration: none;">
|
|
36
48
|
<h5>Minimal example</h5>
|
|
37
49
|
</a>
|
|
38
|
-
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">();</span><br/><br/><span class="hl-5">try</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">res</span><span class="hl-0"> = </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-2">async</span><span class="hl-0"> () </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-1">// Inside the lock. It will stay closed until the promise you return resolves or rejects.</span><br/><span class="hl-0"> </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-4">doSomeAsyncTask</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> </span><span class="hl-7">'my result'</span><span class="hl-0">;</span><br/><span class="hl-0"> });</span><br/><br/><span class="hl-0"> </span><span class="hl-1">// Outside the lock. You will get whatever the promise chain has returned.</span><br/><span class="hl-0"> </span><span class="hl-6">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-6">res</span><span class="hl-0">); </span><span class="hl-1">// "my result"</span><br/><span class="hl-0">}</span><
|
|
50
|
+
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">();</span><br/><br/><span class="hl-5">try</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">res</span><span class="hl-0"> = </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-2">async</span><span class="hl-0"> () </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-1">// Inside the lock. It will stay closed until the promise you return resolves or rejects.</span><br/><span class="hl-0"> </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-4">doSomeAsyncTask</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> </span><span class="hl-7">'my result'</span><span class="hl-0">;</span><br/><span class="hl-0"> });</span><br/><br/><span class="hl-0"> </span><span class="hl-1">// Outside the lock. You will get whatever the promise chain has returned.</span><br/><span class="hl-0"> </span><span class="hl-6">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-6">res</span><span class="hl-0">); </span><span class="hl-1">// "my result"</span><br/><span class="hl-0">} </span><span class="hl-5">catch</span><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-1">// Either your or BetterLock's error</span><br/><span class="hl-0">}</span>
|
|
39
51
|
</code></pre>
|
|
40
52
|
|
|
41
53
|
<a href="#advanced-example" id="advanced-example" style="color: inherit; text-decoration: none;">
|
|
42
54
|
<h5>Advanced example</h5>
|
|
43
55
|
</a>
|
|
44
|
-
<pre><code class="language-typescript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-6">name:</span><span class="hl-0"> </span><span class="hl-7">'FileLock'</span><span class="hl-0">,
|
|
56
|
+
<pre><code class="language-typescript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-6">name:</span><span class="hl-0"> </span><span class="hl-7">'FileLock'</span><span class="hl-0">, </span><span class="hl-1">// To be used in error reporting and logging</span><br/><span class="hl-0"> </span><span class="hl-6">log:</span><span class="hl-0"> </span><span class="hl-6">winstonLogger</span><span class="hl-0">.</span><span class="hl-6">debug</span><span class="hl-0">, </span><span class="hl-1">// Give it your logger with appropeiate level</span><br/><span class="hl-0"> </span><span class="hl-6">wait_timeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0"> * </span><span class="hl-8">30</span><span class="hl-0">, </span><span class="hl-1">// Max 30 sec wait in queue</span><br/><span class="hl-0"> </span><span class="hl-6">execution_timeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0"> * </span><span class="hl-8">60</span><span class="hl-0"> * </span><span class="hl-8">5</span><span class="hl-0">, </span><span class="hl-1">// Time out after 5 minutes</span><br/><span class="hl-0"> </span><span class="hl-6">queue_size:</span><span class="hl-0"> </span><span class="hl-8">1</span><span class="hl-0">, </span><span class="hl-1">// At most one pending job</span><br/><span class="hl-0">});</span><br/><br/><span class="hl-2">async</span><span class="hl-0"> </span><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">processFile</span><span class="hl-0">(</span><span class="hl-6">filename</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-5">try</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">result</span><span class="hl-0"> = </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-6">filename</span><span class="hl-0">, </span><span class="hl-2">async</span><span class="hl-0"> () </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">appended</span><span class="hl-0"> = </span><span class="hl-5">await</span><span class="hl-0"> </span><span class="hl-4">appendToFile</span><span class="hl-0">(</span><span class="hl-6">filename</span><span class="hl-0">);</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> </span><span class="hl-4">updateDb</span><span class="hl-0">(</span><span class="hl-6">appended</span><span class="hl-0">);</span><br/><span class="hl-0"> });</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">status:</span><span class="hl-0"> </span><span class="hl-2">true</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0">,</span><br/><span class="hl-0"> };</span><br/><span class="hl-0"> } </span><span class="hl-5">catch</span><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-5">if</span><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0"> </span><span class="hl-2">instanceof</span><span class="hl-0"> </span><span class="hl-9">BetterLock</span><span class="hl-0">.</span><span class="hl-9">QueueOverflowError</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-1">// The job was discarded</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">status:</span><span class="hl-0"> </span><span class="hl-2">false</span><span class="hl-0">,</span><br/><span class="hl-0"> };</span><br/><span class="hl-0"> }</span><br/><br/><span class="hl-0"> </span><span class="hl-5">if</span><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0"> </span><span class="hl-2">instanceof</span><span class="hl-0"> </span><span class="hl-9">BetterLock</span><span class="hl-0">.</span><span class="hl-9">ExecutionTimeoutError</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-6">winstonLogger</span><span class="hl-0">.</span><span class="hl-4">warn</span><span class="hl-0">(</span><span class="hl-7">'Potential swallowed callback! Stack trace to the entry site:'</span><span class="hl-0">, </span><span class="hl-6">err</span><span class="hl-0">.</span><span class="hl-6">stack</span><span class="hl-0">);</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> </span><span class="hl-5">throw</span><span class="hl-0"> </span><span class="hl-6">err</span><span class="hl-0">;</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">}</span>
|
|
45
57
|
</code></pre>
|
|
46
58
|
|
|
47
59
|
<a href="#locking-on-multiple-keys" id="locking-on-multiple-keys" style="color: inherit; text-decoration: none;">
|
|
48
60
|
<h5>Locking on multiple keys</h5>
|
|
49
61
|
</a>
|
|
50
|
-
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">userLock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-6">name:</span><span class="hl-0"> </span><span class="hl-7">'User lock'</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-6">executionTimeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0"> * </span><span class="hl-8">60</span><span class="hl-0"> * </span><span class="hl-8">60</span><span class="hl-0">, </span><span class="hl-1">// Note you can also use camelCase</span><br/><span class="hl-0">});</span><br/><br/><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">transferBetweenUsers</span><span class="hl-0">(</span><span class="hl-6">fromId</span><span class="hl-0">, </span><span class="hl-6">toId</span><span class="hl-0">, </span><span class="hl-6">amount</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-6">userLock</span><span class="hl-0"
|
|
62
|
+
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">userLock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-6">name:</span><span class="hl-0"> </span><span class="hl-7">'User lock'</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-6">executionTimeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0"> * </span><span class="hl-8">60</span><span class="hl-0"> * </span><span class="hl-8">60</span><span class="hl-0">, </span><span class="hl-1">// Note you can also use camelCase</span><br/><span class="hl-0">});</span><br/><br/><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">transferBetweenUsers</span><span class="hl-0">(</span><span class="hl-6">fromId</span><span class="hl-0">, </span><span class="hl-6">toId</span><span class="hl-0">, </span><span class="hl-6">amount</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-6">userLock</span><br/><span class="hl-0"> .</span><span class="hl-4">acquire</span><span class="hl-0">([</span><span class="hl-6">fromId</span><span class="hl-0">, </span><span class="hl-6">toId</span><span class="hl-0">], () </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> </span><span class="hl-9">Promise</span><span class="hl-0">.</span><span class="hl-4">all</span><span class="hl-0">([</span><span class="hl-6">User</span><span class="hl-0">.</span><span class="hl-4">get</span><span class="hl-0">(</span><span class="hl-6">fromId</span><span class="hl-0">), </span><span class="hl-6">User</span><span class="hl-0">.</span><span class="hl-4">get</span><span class="hl-0">(</span><span class="hl-6">toId</span><span class="hl-0">)]).</span><span class="hl-4">then</span><span class="hl-0">(([</span><span class="hl-6">fromUser</span><span class="hl-0">, </span><span class="hl-6">toUser</span><span class="hl-0">]) </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">fromUser</span><span class="hl-0">.</span><span class="hl-6">amount</span><span class="hl-0"> -= </span><span class="hl-6">amount</span><span class="hl-0">;</span><br/><span class="hl-0"> </span><span class="hl-6">toUser</span><span class="hl-0">.</span><span class="hl-6">amount</span><span class="hl-0"> += </span><span class="hl-6">amount</span><span class="hl-0">;</span><br/><span class="hl-0"> </span><span class="hl-5">return</span><span class="hl-0"> </span><span class="hl-9">Promise</span><span class="hl-0">.</span><span class="hl-4">all</span><span class="hl-0">([</span><span class="hl-6">user1</span><span class="hl-0">.</span><span class="hl-4">save</span><span class="hl-0">(), </span><span class="hl-6">user2</span><span class="hl-0">.</span><span class="hl-4">save</span><span class="hl-0">()]);</span><br/><span class="hl-0"> });</span><br/><span class="hl-0"> })</span><br/><span class="hl-0"> .</span><span class="hl-4">then</span><span class="hl-0">(() </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-6">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-7">'Transfer completed'</span><span class="hl-0">);</span><br/><span class="hl-0"> });</span><br/><span class="hl-0">}</span>
|
|
51
63
|
</code></pre>
|
|
52
64
|
|
|
53
65
|
<a href="#using-callback-interface" id="using-callback-interface" style="color: inherit; text-decoration: none;">
|
|
54
66
|
<h5>Using callback interface</h5>
|
|
55
67
|
</a>
|
|
56
|
-
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">BetterLock</span><span class="hl-0"> = </span><span class="hl-4">require</span><span class="hl-0">(</span><span class="hl-7">'better-lock'</span><span class="hl-0">);</span><br/><br/><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">();</span><br/><span class="hl-1">//...</span><br/><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-6">done</span><span class="hl-0"> </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0">
|
|
68
|
+
<pre><code class="language-javascript"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">BetterLock</span><span class="hl-0"> = </span><span class="hl-4">require</span><span class="hl-0">(</span><span class="hl-7">'better-lock'</span><span class="hl-0">);</span><br/><br/><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">lock</span><span class="hl-0"> = </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-4">BetterLock</span><span class="hl-0">();</span><br/><span class="hl-1">//...</span><br/><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><br/><span class="hl-0"> </span><span class="hl-6">done</span><span class="hl-0"> </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-1">// Inside the lock</span><br/><span class="hl-0"> </span><span class="hl-4">doMyAsyncStuffHere</span><span class="hl-0">(</span><span class="hl-6">err</span><span class="hl-0"> </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-1">// Call done when done</span><br/><span class="hl-0"> </span><span class="hl-4">done</span><span class="hl-0">(</span><span class="hl-6">err</span><span class="hl-0">);</span><br/><span class="hl-0"> });</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0">, </span><span class="hl-6">result</span><span class="hl-0">) </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-1">// Outside the lock</span><br/><span class="hl-0"> </span><span class="hl-5">if</span><span class="hl-0"> (</span><span class="hl-6">err</span><span class="hl-0">) {</span><br/><span class="hl-0"> </span><span class="hl-1">// Either your or BetterLock's error</span><br/><span class="hl-0"> </span><span class="hl-6">console</span><span class="hl-0">.</span><span class="hl-4">error</span><span class="hl-0">(</span><span class="hl-6">err</span><span class="hl-0">);</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">);</span>
|
|
57
69
|
</code></pre>
|
|
58
|
-
<p>You can see a bunch more usage examples in the spec file, <a href="spec/better_lock.spec.
|
|
70
|
+
<p>You can see a bunch more usage examples in the spec file, <a href="spec/better_lock.spec.ts">here</a>;</p>
|
|
59
71
|
|
|
60
72
|
<a href="#api" id="api" style="color: inherit; text-decoration: none;">
|
|
61
73
|
<h3>API</h3>
|
|
@@ -86,10 +98,10 @@
|
|
|
86
98
|
<a href="#options" id="options" style="color: inherit; text-decoration: none;">
|
|
87
99
|
<h3>Options</h3>
|
|
88
100
|
</a>
|
|
89
|
-
<p>All available options can be seen <a href="
|
|
101
|
+
<p>All available options can be seen <a href="https://panta82.github.io/better-lock/interfaces/BetterLockOptions">here</a>.</p>
|
|
90
102
|
<p><code>BetterLockOptions</code> are provided when you construct a lock instance. A subset of options given in <code>LockJobOptions</code> can be provided when you call <code>lock.acquire</code>, as the last argument.</p>
|
|
91
103
|
<p>Example:</p>
|
|
92
|
-
<pre><code class="language-javascript"><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-6">executor</span><span class="hl-0">, </span><span class="hl-6">callback</span><span class="hl-0">, {</span><br/><span class="hl-0"> </span><span class="hl-6">wait_timeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><br/><span class="hl-0">});</span>
|
|
104
|
+
<pre><code class="language-javascript"><span class="hl-6">lock</span><span class="hl-0">.</span><span class="hl-4">acquire</span><span class="hl-0">(</span><span class="hl-6">executor</span><span class="hl-0">, </span><span class="hl-6">callback</span><span class="hl-0">, {</span><br/><span class="hl-0"> </span><span class="hl-6">wait_timeout:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0">,</span><br/><span class="hl-0">});</span>
|
|
93
105
|
</code></pre>
|
|
94
106
|
<p>Most commonly used options are:</p>
|
|
95
107
|
<ul>
|
|
@@ -100,8 +112,10 @@ If you do that, though, and you have a swallowed callback, the lock can remain l
|
|
|
100
112
|
</li>
|
|
101
113
|
<li><p><code>queue_size</code><br>Max queue size for waiting jobs.</p>
|
|
102
114
|
</li>
|
|
115
|
+
<li><p><code>queue_ejection_strategy</code><br>Which job to eject from the queue when it's full. Default is <code>newest</code>.</p>
|
|
116
|
+
</li>
|
|
103
117
|
</ul>
|
|
104
|
-
<p>Default options are a static member <code>DEFAULT_OPTIONS</code> on the <code>BetterLock</code> class.
|
|
118
|
+
<p>Default options are a static member <code>DEFAULT_OPTIONS</code> on the <code>BetterLock</code> class. During runtime, you can change the defaults like this:</p>
|
|
105
119
|
<pre><code class="language-javascript"><span class="hl-5">import</span><span class="hl-0"> </span><span class="hl-6">BetterLock</span><span class="hl-0"> </span><span class="hl-5">from</span><span class="hl-0"> </span><span class="hl-7">'better-lock'</span><span class="hl-0">;</span><br/><br/><span class="hl-6">BetterLock</span><span class="hl-0">.</span><span class="hl-3">DEFAULT_OPTIONS</span><span class="hl-0">.</span><span class="hl-6">wait_timeout</span><span class="hl-0"> = </span><span class="hl-8">1000</span><span class="hl-0">;</span>
|
|
106
120
|
</code></pre>
|
|
107
121
|
|
|
@@ -127,6 +141,21 @@ If you do that, though, and you have a swallowed callback, the lock can remain l
|
|
|
127
141
|
<h3>Change log</h3>
|
|
128
142
|
</a>
|
|
129
143
|
|
|
144
|
+
<a href="#300-20240418" id="300-20240418" style="color: inherit; text-decoration: none;">
|
|
145
|
+
<h4><strong>3.0.0</strong> (<em>2024/04/18</em>)</h4>
|
|
146
|
+
</a>
|
|
147
|
+
<p>Add option <code>queue_ejection_strategy</code>.</p>
|
|
148
|
+
<p>Major version bump because the default strategy changed from "newest" (the old assumed value) to "newest" (makes more sense).</p>
|
|
149
|
+
<p>To migrate, specify:</p>
|
|
150
|
+
<pre><code class="language-javascript"><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-7">"queue_ejection_strategy"</span><span class="hl-0">: </span><span class="hl-7">"newest"</span><br/><span class="hl-0">}</span>
|
|
151
|
+
</code></pre>
|
|
152
|
+
<p>in your job options.</p>
|
|
153
|
+
|
|
154
|
+
<a href="#203-20220528" id="203-20220528" style="color: inherit; text-decoration: none;">
|
|
155
|
+
<h4><strong>2.0.3</strong> (<em>2022/05/28</em>)</h4>
|
|
156
|
+
</a>
|
|
157
|
+
<p>Introduce generated API docs. Remove beta tag from npm version.</p>
|
|
158
|
+
|
|
130
159
|
<a href="#200-20210530" id="200-20210530" style="color: inherit; text-decoration: none;">
|
|
131
160
|
<h4><strong>2.0.0</strong> (<em>2021/05/30</em>)</h4>
|
|
132
161
|
</a>
|
|
@@ -208,4 +237,45 @@ If you do that, though, and you have a swallowed callback, the lock can remain l
|
|
|
208
237
|
<h2>License</h2>
|
|
209
238
|
</a>
|
|
210
239
|
<p><a href="./LICENSE">MIT</a></p>
|
|
211
|
-
</div></div
|
|
240
|
+
</div></div>
|
|
241
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
242
|
+
<div class="tsd-navigation settings">
|
|
243
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
244
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
245
|
+
<div class="tsd-accordion-details">
|
|
246
|
+
<div class="tsd-filter-visibility">
|
|
247
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
248
|
+
<ul id="tsd-filter-options">
|
|
249
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div>
|
|
250
|
+
<div class="tsd-theme-toggle">
|
|
251
|
+
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
252
|
+
<nav class="tsd-navigation primary">
|
|
253
|
+
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
254
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
255
|
+
<div class="tsd-accordion-details">
|
|
256
|
+
<ul>
|
|
257
|
+
<li class="current selected"><a href="modules.html">better-<wbr/>lock</a>
|
|
258
|
+
<ul>
|
|
259
|
+
<li class="tsd-kind-namespace"><a href="modules/_internal_.html"><internal></a>
|
|
260
|
+
<ul>
|
|
261
|
+
<li class="tsd-kind-namespace tsd-parent-kind-namespace"><a href="modules/_internal_.__home_panta_dev_pantas_better_lock_src_errors_.html">"/home/panta/dev/pantas/better-<wbr/>lock/src/errors"</a></li></ul></li></ul></li></ul></div></details></nav>
|
|
262
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
263
|
+
<ul>
|
|
264
|
+
<li class="tsd-kind-reference"><a href="modules.html#default" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-8388608-path"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)" id="icon-8388608-text"></path></svg>default</a></li>
|
|
265
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg>Better<wbr/>Lock<wbr/>Error</a></li>
|
|
266
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockExecutionTimeoutError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Execution<wbr/>Timeout<wbr/>Error</a></li>
|
|
267
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockInternalError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Internal<wbr/>Error</a></li>
|
|
268
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockInvalidArgumentError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Invalid<wbr/>Argument<wbr/>Error</a></li>
|
|
269
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockJobAbortedError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Job<wbr/>Aborted<wbr/>Error</a></li>
|
|
270
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockQueueOverflowError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Queue<wbr/>Overflow<wbr/>Error</a></li>
|
|
271
|
+
<li class="tsd-kind-class"><a href="classes/BetterLockWaitTimeoutError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Better<wbr/>Lock<wbr/>Wait<wbr/>Timeout<wbr/>Error</a></li>
|
|
272
|
+
<li class="tsd-kind-interface"><a href="interfaces/BetterLockJobOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-256-path"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)" id="icon-256-text"></path></svg>Better<wbr/>Lock<wbr/>Job<wbr/>Options</a></li>
|
|
273
|
+
<li class="tsd-kind-interface"><a href="interfaces/BetterLockOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>Better<wbr/>Lock<wbr/>Options</a></li>
|
|
274
|
+
<li class="tsd-kind-type-alias"><a href="types/BetterLockErrorName.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg>Better<wbr/>Lock<wbr/>Error<wbr/>Name</a></li>
|
|
275
|
+
<li class="tsd-kind-type-alias"><a href="types/BetterLockExecutor.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Better<wbr/>Lock<wbr/>Executor</a></li>
|
|
276
|
+
<li class="tsd-kind-type-alias"><a href="types/BetterLockKey.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Better<wbr/>Lock<wbr/>Key</a></li>
|
|
277
|
+
<li class="tsd-kind-type-alias"><a href="types/BetterLockQueueEjectionStrategy.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Better<wbr/>Lock<wbr/>Queue<wbr/>Ejection<wbr/>Strategy</a></li>
|
|
278
|
+
<li class="tsd-kind-variable"><a href="variables/BetterLock.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-32-path"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)" id="icon-32-text"></path></svg>Better<wbr/>Lock</a></li></ul></nav></div></div>
|
|
279
|
+
<div class="container tsd-generator">
|
|
280
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
281
|
+
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
|
@@ -1,9 +1,89 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BetterLockJobOptions | better-lock</title><meta name="description" content="Documentation for better-lock"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
1
|
+
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BetterLockJobOptions | better-lock</title><meta name="description" content="Documentation for better-lock"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base="..">
|
|
4
|
+
<div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<ul class="results">
|
|
6
|
+
<li class="state loading">Preparing search index...</li>
|
|
7
|
+
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">better-lock</a></div>
|
|
8
|
+
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
9
|
+
<div class="container container-main">
|
|
10
|
+
<div class="col-8 col-content">
|
|
11
|
+
<div class="tsd-page-title">
|
|
12
|
+
<ul class="tsd-breadcrumb">
|
|
13
|
+
<li><a href="../modules.html">better-lock</a></li>
|
|
14
|
+
<li><a href="BetterLockJobOptions.html">BetterLockJobOptions</a></li></ul>
|
|
15
|
+
<h1>Interface BetterLockJobOptions</h1></div>
|
|
16
|
+
<section class="tsd-panel tsd-comment">
|
|
17
|
+
<div class="tsd-comment tsd-typography"><p>Options that apply on LockJob</p>
|
|
18
|
+
</div></section>
|
|
19
|
+
<section class="tsd-panel tsd-hierarchy">
|
|
20
|
+
<h4>Hierarchy</h4>
|
|
21
|
+
<ul class="tsd-hierarchy">
|
|
22
|
+
<li><span class="target">BetterLockJobOptions</span>
|
|
23
|
+
<ul class="tsd-hierarchy">
|
|
24
|
+
<li><a href="BetterLockOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BetterLockOptions</a></li></ul></li></ul></section>
|
|
25
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
26
|
+
<section class="tsd-panel tsd-index-panel">
|
|
27
|
+
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
28
|
+
<h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex=0><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></svg> Index</h5></summary>
|
|
29
|
+
<div class="tsd-accordion-details">
|
|
30
|
+
<section class="tsd-index-section">
|
|
31
|
+
<h3 class="tsd-index-heading">Properties</h3>
|
|
32
|
+
<div class="tsd-index-list"><a href="BetterLockJobOptions.html#execution_timeout" class="tsd-index-link tsd-kind-property tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-1024-path"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)" id="icon-1024-text"></path></svg><span>execution_<wbr/>timeout</span></a>
|
|
33
|
+
<a href="BetterLockJobOptions.html#extend_stack_traces" class="tsd-index-link tsd-kind-property tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>extend_<wbr/>stack_<wbr/>traces</span></a>
|
|
34
|
+
<a href="BetterLockJobOptions.html#wait_timeout" class="tsd-index-link tsd-kind-property tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>wait_<wbr/>timeout</span></a>
|
|
35
|
+
</div></section></div></details></section></section>
|
|
36
|
+
<section class="tsd-panel-group tsd-member-group">
|
|
37
|
+
<h2>Properties</h2>
|
|
38
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="execution_timeout" class="tsd-anchor"></a>
|
|
39
|
+
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>execution_<wbr/>timeout</span><a href="#execution_timeout" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
|
|
40
|
+
<div class="tsd-signature">execution_<wbr/>timeout<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
|
|
41
|
+
<div class="tsd-comment tsd-typography"><p>How long can a job be executing before timing out. Null to disable timeout. Overrides BetterLockOptions value.</p>
|
|
42
|
+
</div><aside class="tsd-sources">
|
|
43
|
+
<ul>
|
|
44
|
+
<li>Defined in <a href="https://github.com/panta82/better-lock/blob/336aa4f/src/options.ts#L13">options.ts:13</a></li></ul></aside></section>
|
|
45
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="extend_stack_traces" class="tsd-anchor"></a>
|
|
46
|
+
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>extend_<wbr/>stack_<wbr/>traces</span><a href="#extend_stack_traces" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
47
|
+
<div class="tsd-signature">extend_<wbr/>stack_<wbr/>traces<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div>
|
|
48
|
+
<div class="tsd-comment tsd-typography"><p>In any error produced by BetterLock, extend the stack trace to include incoming trace. Overrides BetterLockOptions value.</p>
|
|
49
|
+
</div><aside class="tsd-sources">
|
|
50
|
+
<ul>
|
|
51
|
+
<li>Defined in <a href="https://github.com/panta82/better-lock/blob/336aa4f/src/options.ts#L18">options.ts:18</a></li></ul></aside></section>
|
|
52
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="wait_timeout" class="tsd-anchor"></a>
|
|
53
|
+
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>wait_<wbr/>timeout</span><a href="#wait_timeout" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
54
|
+
<div class="tsd-signature">wait_<wbr/>timeout<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
|
|
55
|
+
<div class="tsd-comment tsd-typography"><p>How long can jobs wait in queue before timing out. Overrides BetterLockOptions value.</p>
|
|
56
|
+
</div><aside class="tsd-sources">
|
|
57
|
+
<ul>
|
|
58
|
+
<li>Defined in <a href="https://github.com/panta82/better-lock/blob/336aa4f/src/options.ts#L8">options.ts:8</a></li></ul></aside></section></section></div>
|
|
59
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
60
|
+
<div class="tsd-navigation settings">
|
|
61
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
62
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
63
|
+
<div class="tsd-accordion-details">
|
|
64
|
+
<div class="tsd-filter-visibility">
|
|
65
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
66
|
+
<ul id="tsd-filter-options">
|
|
67
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div>
|
|
68
|
+
<div class="tsd-theme-toggle">
|
|
69
|
+
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
70
|
+
<nav class="tsd-navigation primary">
|
|
71
|
+
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
72
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
73
|
+
<div class="tsd-accordion-details">
|
|
74
|
+
<ul>
|
|
75
|
+
<li><a href="../modules.html">better-<wbr/>lock</a>
|
|
76
|
+
<ul>
|
|
77
|
+
<li class="tsd-kind-namespace"><a href="../modules/_internal_.html"><internal></a>
|
|
78
|
+
<ul>
|
|
79
|
+
<li class="tsd-kind-namespace tsd-parent-kind-namespace"><a href="../modules/_internal_.__home_panta_dev_pantas_better_lock_src_errors_.html">"/home/panta/dev/pantas/better-<wbr/>lock/src/errors"</a></li></ul></li></ul></li></ul></div></details></nav>
|
|
80
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
81
|
+
<ul>
|
|
82
|
+
<li class="current tsd-kind-interface"><a href="BetterLockJobOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-256-path"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)" id="icon-256-text"></path></svg><span>Better<wbr/>Lock<wbr/>Job<wbr/>Options</span></a>
|
|
83
|
+
<ul>
|
|
84
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="BetterLockJobOptions.html#execution_timeout" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>execution_<wbr/>timeout</a></li>
|
|
85
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="BetterLockJobOptions.html#extend_stack_traces" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>extend_<wbr/>stack_<wbr/>traces</a></li>
|
|
86
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="BetterLockJobOptions.html#wait_timeout" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>wait_<wbr/>timeout</a></li></ul></li></ul></nav></div></div>
|
|
87
|
+
<div class="container tsd-generator">
|
|
88
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
89
|
+
<div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|