Version 2.2.0
[poolifier.git] / docs / interfaces / workeroptions.html
CommitLineData
5ea22628
JB
1<!doctype html>
2<html class="default no-js">
3<head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <title>WorkerOptions | poolifier</title>
7 <meta name="description" content="Documentation for poolifier">
8 <meta name="viewport" content="width=device-width, initial-scale=1">
9 <link rel="stylesheet" href="../assets/css/main.css">
10 <script async src="../assets/js/search.js" id="search-script"></script>
11</head>
12<body>
13<header>
14 <div class="tsd-page-toolbar">
15 <div class="container">
16 <div class="table-wrap">
17 <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18 <div class="field">
19 <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20 <input id="tsd-search-field" type="text" />
21 </div>
22 <ul class="results">
23 <li class="state loading">Preparing search index...</li>
24 <li class="state failure">The search index is not available</li>
25 </ul>
26 <a href="../index.html" class="title">poolifier</a>
27 </div>
28 <div class="table-cell" id="tsd-widgets">
29 <div id="tsd-filter">
30 <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31 <div class="tsd-filter-group">
32 <div class="tsd-select" id="tsd-filter-visibility">
33 <span class="tsd-select-label">All</span>
34 <ul class="tsd-select-list">
35 <li data-value="public">Public</li>
36 <li data-value="protected">Public/Protected</li>
37 <li data-value="private" class="selected">All</li>
38 </ul>
39 </div>
40 <input type="checkbox" id="tsd-filter-inherited" checked />
41 <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42 <input type="checkbox" id="tsd-filter-externals" checked />
43 <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44 </div>
45 </div>
46 <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47 </div>
48 </div>
49 </div>
50 </div>
51 <div class="tsd-page-title">
52 <div class="container">
53 <ul class="tsd-breadcrumb">
54 <li>
55 <a href="../index.html">poolifier</a>
56 </li>
57 <li>
58 <a href="workeroptions.html">WorkerOptions</a>
59 </li>
60 </ul>
61 <h1>Interface WorkerOptions</h1>
62 </div>
63 </div>
64</header>
65<div class="container container-main">
66 <div class="row">
67 <div class="col-8 col-content">
68 <section class="tsd-panel tsd-comment">
69 <div class="tsd-comment tsd-typography">
70 <div class="lead">
71 <p>Options for workers.</p>
72 </div>
73 </div>
74 </section>
75 <section class="tsd-panel tsd-hierarchy">
76 <h3>Hierarchy</h3>
77 <ul class="tsd-hierarchy">
78 <li>
79 <span class="target">WorkerOptions</span>
80 </li>
81 </ul>
82 </section>
83 <section class="tsd-panel-group tsd-index-group">
84 <h2>Index</h2>
85 <section class="tsd-panel tsd-index-panel">
86 <div class="tsd-index-content">
87 <section class="tsd-index-section ">
88 <h3>Properties</h3>
89 <ul class="tsd-index-list">
90 <li class="tsd-kind-property tsd-parent-kind-interface"><a href="workeroptions.html#async" class="tsd-kind-icon">async</a></li>
91 <li class="tsd-kind-property tsd-parent-kind-interface"><a href="workeroptions.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a></li>
92 <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>
93 </ul>
94 </section>
95 </div>
96 </section>
97 </section>
98 <section class="tsd-panel-group tsd-member-group ">
99 <h2>Properties</h2>
100 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
101 <a name="async" class="tsd-anchor"></a>
102 <h3><span class="tsd-flag ts-flagOptional">Optional</span> async</h3>
103 <div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div>
104 <aside class="tsd-sources">
105 <ul>
849e0547 106 <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/worker-options.ts#L57">src/worker/worker-options.ts:57</a></li>
5ea22628
JB
107 </ul>
108 </aside>
109 <div class="tsd-comment tsd-typography">
110 <div class="lead">
111 <p>Whether your worker will perform asynchronous or not.</p>
112 </div>
113 <dl class="tsd-comment-tags">
114 <dt>default</dt>
115 <dd><p>false</p>
116 </dd>
117 </dl>
118 </div>
119 </section>
120 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
121 <a name="killbehavior" class="tsd-anchor"></a>
122 <h3><span class="tsd-flag ts-flagOptional">Optional</span> kill<wbr>Behavior</h3>
123 <div class="tsd-signature tsd-kind-icon">kill<wbr>Behavior<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><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>
124 <aside class="tsd-sources">
125 <ul>
849e0547 126 <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/worker-options.ts#L68">src/worker/worker-options.ts:68</a></li>
5ea22628
JB
127 </ul>
128 </aside>
129 <div class="tsd-comment tsd-typography">
130 <div class="lead">
131 <p><code>killBehavior</code> dictates if your async unit (worker/process) will be deleted in case that a task is active on it.</p>
132 </div>
133 <ul>
134 <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>
135 <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>
136 </ul>
137 <p>This option only apply to the newly created workers.</p>
138 <dl class="tsd-comment-tags">
139 <dt>default</dt>
140 <dd><p>KillBehaviors.SOFT</p>
141 </dd>
142 </dl>
143 </div>
144 </section>
145 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
146 <a name="maxinactivetime" class="tsd-anchor"></a>
147 <h3><span class="tsd-flag ts-flagOptional">Optional</span> max<wbr>Inactive<wbr>Time</h3>
148 <div class="tsd-signature tsd-kind-icon">max<wbr>Inactive<wbr>Time<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div>
149 <aside class="tsd-sources">
150 <ul>
849e0547 151 <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/worker-options.ts#L51">src/worker/worker-options.ts:51</a></li>
5ea22628
JB
152 </ul>
153 </aside>
154 <div class="tsd-comment tsd-typography">
155 <div class="lead">
156 <p>Maximum waiting time in milliseconds for tasks.</p>
157 </div>
158 <p>After this time, newly created workers will be terminated.
159 The 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>
160 <ul>
161 <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,
162 when this timeout expires your tasks is interrupted and the worker is killed if is not part of the minimum size of the pool.</li>
163 <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>
164 </ul>
165 <dl class="tsd-comment-tags">
166 <dt>default</dt>
167 <dd><p>60.000 ms</p>
168 </dd>
169 </dl>
170 </div>
171 </section>
172 </section>
173 </div>
174 <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
175 <nav class="tsd-navigation primary">
176 <ul>
177 <li class=" ">
178 <a href="../index.html">Exports</a>
179 </li>
180 </ul>
181 </nav>
182 <nav class="tsd-navigation secondary menu-sticky">
183 <ul class="before-current">
184 <li class=" tsd-kind-class tsd-has-type-parameter">
185 <a href="../classes/abstractworker.html" class="tsd-kind-icon">Abstract<wbr>Worker</a>
186 </li>
187 <li class=" tsd-kind-class tsd-has-type-parameter">
188 <a href="../classes/clusterworker.html" class="tsd-kind-icon">Cluster<wbr>Worker</a>
189 </li>
190 <li class=" tsd-kind-class tsd-has-type-parameter">
191 <a href="../classes/dynamicclusterpool.html" class="tsd-kind-icon">Dynamic<wbr>Cluster<wbr>Pool</a>
192 </li>
193 <li class=" tsd-kind-class tsd-has-type-parameter">
194 <a href="../classes/dynamicthreadpool.html" class="tsd-kind-icon">Dynamic<wbr>Thread<wbr>Pool</a>
195 </li>
196 <li class=" tsd-kind-class tsd-has-type-parameter">
197 <a href="../classes/fixedclusterpool.html" class="tsd-kind-icon">Fixed<wbr>Cluster<wbr>Pool</a>
198 </li>
199 <li class=" tsd-kind-class tsd-has-type-parameter">
200 <a href="../classes/fixedthreadpool.html" class="tsd-kind-icon">Fixed<wbr>Thread<wbr>Pool</a>
201 </li>
202 <li class=" tsd-kind-class tsd-has-type-parameter">
203 <a href="../classes/threadworker.html" class="tsd-kind-icon">Thread<wbr>Worker</a>
204 </li>
205 <li class=" tsd-kind-interface">
206 <a href="clusterpooloptions.html" class="tsd-kind-icon">Cluster<wbr>Pool<wbr>Options</a>
207 </li>
208 <li class=" tsd-kind-interface tsd-has-type-parameter">
209 <a href="ipool.html" class="tsd-kind-icon">IPool</a>
210 </li>
211 <li class=" tsd-kind-interface">
212 <a href="iworker.html" class="tsd-kind-icon">IWorker</a>
213 </li>
214 <li class=" tsd-kind-interface tsd-has-type-parameter">
215 <a href="pooloptions.html" class="tsd-kind-icon">Pool<wbr>Options</a>
216 </li>
217 </ul>
218 <ul class="current">
219 <li class="current tsd-kind-interface">
220 <a href="workeroptions.html" class="tsd-kind-icon">Worker<wbr>Options</a>
221 <ul>
222 <li class=" tsd-kind-property tsd-parent-kind-interface">
223 <a href="workeroptions.html#async" class="tsd-kind-icon">async</a>
224 </li>
225 <li class=" tsd-kind-property tsd-parent-kind-interface">
226 <a href="workeroptions.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a>
227 </li>
228 <li class=" tsd-kind-property tsd-parent-kind-interface">
229 <a href="workeroptions.html#maxinactivetime" class="tsd-kind-icon">max<wbr>Inactive<wbr>Time</a>
230 </li>
231 </ul>
232 </li>
233 </ul>
234 <ul class="after-current">
235 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
236 <a href="../index.html#errorhandler" class="tsd-kind-icon">Error<wbr>Handler</a>
237 </li>
238 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
239 <a href="../index.html#exithandler" class="tsd-kind-icon">Exit<wbr>Handler</a>
240 </li>
241 <li class=" tsd-kind-type-alias">
242 <a href="../index.html#killbehavior" class="tsd-kind-icon">Kill<wbr>Behavior</a>
243 </li>
244 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
245 <a href="../index.html#onlinehandler" class="tsd-kind-icon">Online<wbr>Handler</a>
246 </li>
247 <li class=" tsd-kind-type-alias">
248 <a href="../index.html#threadworkerwithmessagechannel" class="tsd-kind-icon">Thread<wbr>Worker<wbr>With<wbr>Message<wbr>Channel</a>
249 </li>
250 <li class=" tsd-kind-type-alias">
251 <a href="../index.html#workerchoicestrategy" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategy</a>
252 </li>
253 <li class=" tsd-kind-variable">
254 <a href="../index.html#killbehaviors" class="tsd-kind-icon">Kill<wbr>Behaviors</a>
255 </li>
256 <li class=" tsd-kind-variable">
257 <a href="../index.html#workerchoicestrategies" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategies</a>
258 </li>
259 </ul>
260 </nav>
261 </div>
262 </div>
263</div>
264<footer class="with-border-bottom">
265 <div class="container">
266 <h2>Legend</h2>
267 <div class="tsd-legend-group">
268 <ul class="tsd-legend">
269 <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
270 <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
271 </ul>
272 <ul class="tsd-legend">
273 <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
274 <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
275 </ul>
276 <ul class="tsd-legend">
277 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
278 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
279 </ul>
280 <ul class="tsd-legend">
281 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
282 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
283 </ul>
284 <ul class="tsd-legend">
285 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
286 </ul>
287 </div>
288 </div>
289</footer>
290<div class="container tsd-generator">
291 <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
292</div>
293<div class="overlay"></div>
294<script src="../assets/js/main.js"></script>
295</body>
296</html>