2 <html class=
"default no-js">
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>
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=
"..">
19 <label for=
"tsd-search-field" class=
"tsd-widget search no-caption">Search
</label>
20 <input id=
"tsd-search-field" type=
"text" />
23 <li class=
"state loading">Preparing search index...
</li>
24 <li class=
"state failure">The search index is not available
</li>
26 <a href=
"../index.html" class=
"title">poolifier
</a>
28 <div class=
"table-cell" id=
"tsd-widgets">
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>
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>
46 <a href=
"#" class=
"tsd-widget menu no-caption" data-toggle=
"menu">Menu
</a>
51 <div class=
"tsd-page-title">
52 <div class=
"container">
53 <ul class=
"tsd-breadcrumb">
55 <a href=
"../index.html">poolifier
</a>
58 <a href=
"workeroptions.html">WorkerOptions
</a>
61 <h1>Interface WorkerOptions
</h1>
65 <div class=
"container container-main">
67 <div class=
"col-8 col-content">
68 <section class=
"tsd-panel tsd-comment">
69 <div class=
"tsd-comment tsd-typography">
71 <p>Options for workers.
</p>
75 <section class=
"tsd-panel tsd-hierarchy">
77 <ul class=
"tsd-hierarchy">
79 <span class=
"target">WorkerOptions
</span>
83 <section class=
"tsd-panel-group tsd-index-group">
85 <section class=
"tsd-panel tsd-index-panel">
86 <div class=
"tsd-index-content">
87 <section class=
"tsd-index-section ">
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>
98 <section class=
"tsd-panel-group tsd-member-group ">
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">
106 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/worker/worker-options.ts#L57">src/worker/worker-options.ts:
57</a></li>
109 <div class=
"tsd-comment tsd-typography">
111 <p>Whether your worker will perform asynchronous or not.
</p>
113 <dl class=
"tsd-comment-tags">
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">"SOFT
"</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">"HARD
"</span></div>
124 <aside class=
"tsd-sources">
126 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/worker/worker-options.ts#L68">src/worker/worker-options.ts:
68</a></li>
129 <div class=
"tsd-comment tsd-typography">
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>
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
'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>
137 <p>This option only apply to the newly created workers.
</p>
138 <dl class=
"tsd-comment-tags">
140 <dd><p>KillBehaviors.SOFT
</p>
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">
151 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/worker/worker-options.ts#L51">src/worker/worker-options.ts:
51</a></li>
154 <div class=
"tsd-comment tsd-typography">
156 <p>Maximum waiting time in milliseconds for tasks.
</p>
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>
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>
165 <dl class=
"tsd-comment-tags">
174 <div class=
"col-4 col-menu menu-sticky-wrap menu-highlight">
175 <nav class=
"tsd-navigation primary">
178 <a href=
"../index.html">Exports
</a>
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>
187 <li class=
" tsd-kind-class tsd-has-type-parameter">
188 <a href=
"../classes/clusterworker.html" class=
"tsd-kind-icon">Cluster
<wbr>Worker
</a>
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>
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>
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>
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>
202 <li class=
" tsd-kind-class tsd-has-type-parameter">
203 <a href=
"../classes/threadworker.html" class=
"tsd-kind-icon">Thread
<wbr>Worker
</a>
205 <li class=
" tsd-kind-interface">
206 <a href=
"clusterpooloptions.html" class=
"tsd-kind-icon">Cluster
<wbr>Pool
<wbr>Options
</a>
208 <li class=
" tsd-kind-interface tsd-has-type-parameter">
209 <a href=
"ipool.html" class=
"tsd-kind-icon">IPool
</a>
211 <li class=
" tsd-kind-interface">
212 <a href=
"iworker.html" class=
"tsd-kind-icon">IWorker
</a>
214 <li class=
" tsd-kind-interface tsd-has-type-parameter">
215 <a href=
"pooloptions.html" class=
"tsd-kind-icon">Pool
<wbr>Options
</a>
219 <li class=
"current tsd-kind-interface">
220 <a href=
"workeroptions.html" class=
"tsd-kind-icon">Worker
<wbr>Options
</a>
222 <li class=
" tsd-kind-property tsd-parent-kind-interface">
223 <a href=
"workeroptions.html#async" class=
"tsd-kind-icon">async
</a>
225 <li class=
" tsd-kind-property tsd-parent-kind-interface">
226 <a href=
"workeroptions.html#killbehavior" class=
"tsd-kind-icon">kill
<wbr>Behavior
</a>
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>
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>
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>
241 <li class=
" tsd-kind-type-alias">
242 <a href=
"../index.html#killbehavior" class=
"tsd-kind-icon">Kill
<wbr>Behavior
</a>
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>
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>
250 <li class=
" tsd-kind-type-alias">
251 <a href=
"../index.html#workerchoicestrategy" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategy
</a>
253 <li class=
" tsd-kind-variable">
254 <a href=
"../index.html#killbehaviors" class=
"tsd-kind-icon">Kill
<wbr>Behaviors
</a>
256 <li class=
" tsd-kind-variable">
257 <a href=
"../index.html#workerchoicestrategies" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategies
</a>
264 <footer class=
"with-border-bottom">
265 <div class=
"container">
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>
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>
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>
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>
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>
290 <div class=
"container tsd-generator">
291 <p>Generated using
<a href=
"https://typedoc.org/" target=
"_blank">TypeDoc
</a></p>
293 <div class=
"overlay"></div>
294 <script src=
"../assets/js/main.js"></script>