Add UTs for WorkerChoiceStrategyContext
[poolifier.git] / docs / interfaces / WorkerOptions.html
CommitLineData
24c3fcb4
JB
1<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WorkerOptions | poolifier</title><meta name="description" content="Documentation for poolifier"/><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.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">poolifier</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">poolifier</a></li><li><a href="WorkerOptions.html">WorkerOptions</a></li></ul><h1>Interface WorkerOptions</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
2<p>Options for workers.</p>
d0f1dce3 3</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WorkerOptions</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#killBehavior" class="tsd-kind-icon">kill<wbr/>Behavior</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#maxInactiveTime" class="tsd-kind-icon">max<wbr/>Inactive<wbr/>Time</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="async" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> async</h3><div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/poolifier/poolifier/blob/0136f64/src/worker/worker-options.ts#L57">src/worker/worker-options.ts:57</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
24c3fcb4
JB
4<p>Whether your worker will perform asynchronous or not.</p>
5</div><dl class="tsd-comment-tags"><dt>default</dt><dd><p>false</p>
d0f1dce3 6</dd></dl></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="killBehavior" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> kill<wbr/>Behavior</h3><div class="tsd-signature tsd-kind-icon">kill<wbr/>Behavior<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">&quot;SOFT&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;HARD&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/poolifier/poolifier/blob/0136f64/src/worker/worker-options.ts#L68">src/worker/worker-options.ts:68</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
24c3fcb4
JB
7<p><code>killBehavior</code> dictates if your async unit (worker/process) will be deleted in case that a task is active on it.</p>
8</div><div><ul>
9<li>SOFT: If <code>currentTime - lastActiveTime</code> is greater than <code>maxInactiveTime</code> but a task is still running, then the worker <strong>won&#39;t</strong> be deleted.</li>
10<li>HARD: If <code>lastActiveTime</code> is greater than <code>maxInactiveTime</code> but a task is still running, then the worker will be deleted.</li>
11</ul>
12<p>This option only apply to the newly created workers.</p>
13</div><dl class="tsd-comment-tags"><dt>default</dt><dd><p>KillBehaviors.SOFT</p>
d0f1dce3 14</dd></dl></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="maxInactiveTime" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> max<wbr/>Inactive<wbr/>Time</h3><div class="tsd-signature tsd-kind-icon">max<wbr/>Inactive<wbr/>Time<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/poolifier/poolifier/blob/0136f64/src/worker/worker-options.ts#L51">src/worker/worker-options.ts:51</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
24c3fcb4
JB
15<p>Maximum waiting time in milliseconds for tasks.</p>
16</div><div><p>After this time, newly created workers will be terminated.
17The last active time of your worker unit will be updated when a task is submitted to a worker or when a worker terminate a task.</p>
18<ul>
19<li>If <code>killBehavior</code> is set to <code>KillBehaviors.HARD</code> this value represents also the timeout for the tasks that you submit to the pool,
20when this timeout expires your tasks is interrupted and the worker is killed if is not part of the minimum size of the pool.</li>
21<li>If <code>killBehavior</code> is set to <code>KillBehaviors.SOFT</code> your tasks have no timeout and your workers will not be terminated until your task is completed.</li>
22</ul>
23</div><dl class="tsd-comment-tags"><dt>default</dt><dd><p>60.000 ms</p>
24</dd></dl></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="WorkerOptions.html" class="tsd-kind-icon">Worker<wbr/>Options</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#killBehavior" class="tsd-kind-icon">kill<wbr/>Behavior</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="WorkerOptions.html#maxInactiveTime" class="tsd-kind-icon">max<wbr/>Inactive<wbr/>Time</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>