Commit | Line | Data |
---|---|---|
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>ClusterWorker | 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="clusterworker.html">ClusterWorker</a> | |
59 | </li> | |
60 | </ul> | |
61 | <h1>Class ClusterWorker<Data, Response></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>A cluster worker used by a poolifier <code>ClusterPool</code>.</p> | |
72 | </div> | |
73 | <p>When this worker is inactive for more than the given <code>maxInactiveTime</code>, | |
74 | it will send a termination request to its main worker.</p> | |
75 | <p>If you use a <code>DynamicClusterPool</code> the extra workers that were created will be terminated, | |
76 | but the minimum number of workers will be guaranteed.</p> | |
77 | <dl class="tsd-comment-tags"> | |
78 | <dt>author</dt> | |
79 | <dd><p><a href="https://github.com/Shinigami92">Christopher Quadflieg</a></p> | |
80 | </dd> | |
81 | <dt>since</dt> | |
82 | <dd><p>2.0.0</p> | |
83 | </dd> | |
84 | </dl> | |
85 | </div> | |
86 | </section> | |
87 | <section class="tsd-panel tsd-type-parameters"> | |
88 | <h3>Type parameters</h3> | |
89 | <ul class="tsd-type-parameters"> | |
90 | <li> | |
91 | <h4>Data = <span class="tsd-signature-type">unknown</span></h4> | |
92 | <div class="tsd-comment tsd-typography"> | |
93 | <div class="lead"> | |
94 | <p>Type of data this worker receives from pool's execution. This can only be serializable data.</p> | |
95 | </div> | |
96 | </div> | |
97 | </li> | |
98 | <li> | |
99 | <h4>Response = <span class="tsd-signature-type">unknown</span></h4> | |
100 | <div class="tsd-comment tsd-typography"> | |
101 | <div class="lead"> | |
102 | <p>Type of response the worker sends back to the main worker. This can only be serializable data.</p> | |
103 | </div> | |
104 | </div> | |
105 | </li> | |
106 | </ul> | |
107 | </section> | |
108 | <section class="tsd-panel tsd-hierarchy"> | |
109 | <h3>Hierarchy</h3> | |
110 | <ul class="tsd-hierarchy"> | |
111 | <li> | |
112 | <a href="abstractworker.html" class="tsd-signature-type" data-tsd-kind="Class">AbstractWorker</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Worker</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span> | |
113 | <ul class="tsd-hierarchy"> | |
114 | <li> | |
115 | <span class="target">ClusterWorker</span> | |
116 | </li> | |
117 | </ul> | |
118 | </li> | |
119 | </ul> | |
120 | </section> | |
121 | <section class="tsd-panel-group tsd-index-group"> | |
122 | <h2>Index</h2> | |
123 | <section class="tsd-panel tsd-index-panel"> | |
124 | <div class="tsd-index-content"> | |
125 | <section class="tsd-index-section "> | |
126 | <h3>Constructors</h3> | |
127 | <ul class="tsd-index-list"> | |
128 | <li class="tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited"><a href="clusterworker.html#constructor" class="tsd-kind-icon">constructor</a></li> | |
129 | </ul> | |
130 | </section> | |
131 | <section class="tsd-index-section "> | |
132 | <h3>Properties</h3> | |
133 | <ul class="tsd-index-list"> | |
134 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#async" class="tsd-kind-icon">async</a></li> | |
135 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#interval" class="tsd-kind-icon">interval</a></li> | |
136 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a></li> | |
137 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#lasttask" class="tsd-kind-icon">last<wbr>Task</a></li> | |
138 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#mainworker" class="tsd-kind-icon">main<wbr>Worker</a></li> | |
139 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#maxinactivetime" class="tsd-kind-icon">max<wbr>Inactive<wbr>Time</a></li> | |
140 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="clusterworker.html#opts" class="tsd-kind-icon">opts</a></li> | |
141 | </ul> | |
142 | </section> | |
143 | <section class="tsd-index-section "> | |
144 | <h3>Methods</h3> | |
145 | <ul class="tsd-index-list"> | |
146 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="clusterworker.html#asyncid" class="tsd-kind-icon">async<wbr>Id</a></li> | |
147 | <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"><a href="clusterworker.html#bind" class="tsd-kind-icon">bind</a></li> | |
148 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#checkalive" class="tsd-kind-icon">check<wbr>Alive</a></li> | |
149 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="clusterworker.html#emitdestroy" class="tsd-kind-icon">emit<wbr>Destroy</a></li> | |
150 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#getmainworker" class="tsd-kind-icon">get<wbr>Main<wbr>Worker</a></li> | |
151 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"><a href="clusterworker.html#handleerror" class="tsd-kind-icon">handle<wbr>Error</a></li> | |
152 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#run" class="tsd-kind-icon">run</a></li> | |
153 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href="clusterworker.html#runasync" class="tsd-kind-icon">run<wbr>Async</a></li> | |
154 | <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"><a href="clusterworker.html#runinasyncscope" class="tsd-kind-icon">run<wbr>InAsync<wbr>Scope</a></li> | |
155 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"><a href="clusterworker.html#sendtomainworker" class="tsd-kind-icon">send<wbr>ToMain<wbr>Worker</a></li> | |
156 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="clusterworker.html#triggerasyncid" class="tsd-kind-icon">trigger<wbr>Async<wbr>Id</a></li> | |
157 | <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external"><a href="clusterworker.html#bind-1" class="tsd-kind-icon">bind</a></li> | |
158 | </ul> | |
159 | </section> | |
160 | </div> | |
161 | </section> | |
162 | </section> | |
163 | <section class="tsd-panel-group tsd-member-group "> | |
164 | <h2>Constructors</h2> | |
165 | <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited"> | |
166 | <a name="constructor" class="tsd-anchor"></a> | |
167 | <h3>constructor</h3> | |
168 | <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited"> | |
169 | <li class="tsd-signature tsd-kind-icon">new <wbr>Cluster<wbr>Worker<Data, Response><span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Response</span>, opts<span class="tsd-signature-symbol">?: </span><a href="../interfaces/workeroptions.html" class="tsd-signature-type" data-tsd-kind="Interface">WorkerOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="clusterworker.html" class="tsd-signature-type" data-tsd-kind="Class">ClusterWorker</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span></li> | |
170 | </ul> | |
171 | <ul class="tsd-descriptions"> | |
172 | <li class="tsd-description"> | |
173 | <aside class="tsd-sources"> | |
174 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#constructor">constructor</a></p> | |
175 | <ul> | |
849e0547 | 176 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/cluster-worker.ts#L25">src/worker/cluster-worker.ts:25</a></li> |
5ea22628 JB |
177 | </ul> |
178 | </aside> | |
179 | <div class="tsd-comment tsd-typography"> | |
180 | <div class="lead"> | |
181 | <p>Constructs a new poolifier cluster worker.</p> | |
182 | </div> | |
183 | </div> | |
184 | <h4 class="tsd-type-parameters-title">Type parameters</h4> | |
185 | <ul class="tsd-type-parameters"> | |
186 | <li> | |
187 | <h4>Data = <span class="tsd-signature-type">unknown</span></h4> | |
188 | </li> | |
189 | <li> | |
190 | <h4>Response = <span class="tsd-signature-type">unknown</span></h4> | |
191 | </li> | |
192 | </ul> | |
193 | <h4 class="tsd-parameters-title">Parameters</h4> | |
194 | <ul class="tsd-parameters"> | |
195 | <li> | |
196 | <h5>fn: <span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Response</span></h5> | |
197 | <div class="tsd-comment tsd-typography"> | |
198 | <p>Function processed by the worker when the pool's <code>execution</code> function is invoked.</p> | |
199 | </div> | |
200 | <ul class="tsd-parameters"> | |
201 | <li class="tsd-parameter-signature"> | |
202 | <ul class="tsd-signatures tsd-kind-type-literal"> | |
203 | <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Response</span></li> | |
204 | </ul> | |
205 | <ul class="tsd-descriptions"> | |
206 | <li class="tsd-description"> | |
207 | <h4 class="tsd-parameters-title">Parameters</h4> | |
208 | <ul class="tsd-parameters"> | |
209 | <li> | |
210 | <h5>data: <span class="tsd-signature-type">Data</span></h5> | |
211 | </li> | |
212 | </ul> | |
213 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Response</span></h4> | |
214 | </li> | |
215 | </ul> | |
216 | </li> | |
217 | </ul> | |
218 | </li> | |
219 | <li> | |
220 | <h5>opts: <a href="../interfaces/workeroptions.html" class="tsd-signature-type" data-tsd-kind="Interface">WorkerOptions</a><span class="tsd-signature-symbol"> = ...</span></h5> | |
221 | <div class="tsd-comment tsd-typography"> | |
222 | <p>Options for the worker.</p> | |
223 | </div> | |
224 | </li> | |
225 | </ul> | |
226 | <h4 class="tsd-returns-title">Returns <a href="clusterworker.html" class="tsd-signature-type" data-tsd-kind="Class">ClusterWorker</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span></h4> | |
227 | </li> | |
228 | </ul> | |
229 | </section> | |
230 | </section> | |
231 | <section class="tsd-panel-group tsd-member-group "> | |
232 | <h2>Properties</h2> | |
233 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
234 | <a name="async" class="tsd-anchor"></a> | |
235 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> async</h3> | |
236 | <div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> | |
237 | <aside class="tsd-sources"> | |
238 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#async">async</a></p> | |
239 | <ul> | |
849e0547 | 240 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L34">src/worker/abstract-worker.ts:34</a></li> |
5ea22628 JB |
241 | </ul> |
242 | </aside> | |
243 | <div class="tsd-comment tsd-typography"> | |
244 | <div class="lead"> | |
245 | <p>Whether the worker is working asynchronously or not.</p> | |
246 | </div> | |
247 | </div> | |
248 | </section> | |
249 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
250 | <a name="interval" class="tsd-anchor"></a> | |
251 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagOptional">Optional</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> interval</h3> | |
252 | <div class="tsd-signature tsd-kind-icon">interval<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Timeout</span></div> | |
253 | <aside class="tsd-sources"> | |
254 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#interval">interval</a></p> | |
255 | <ul> | |
849e0547 | 256 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L42">src/worker/abstract-worker.ts:42</a></li> |
5ea22628 JB |
257 | </ul> |
258 | </aside> | |
259 | <div class="tsd-comment tsd-typography"> | |
260 | <div class="lead"> | |
261 | <p>Handler ID of the <code>interval</code> alive check.</p> | |
262 | </div> | |
263 | </div> | |
264 | </section> | |
265 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
266 | <a name="killbehavior" class="tsd-anchor"></a> | |
267 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> kill<wbr>Behavior</h3> | |
268 | <div class="tsd-signature tsd-kind-icon">kill<wbr>Behavior<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> | |
269 | <aside class="tsd-sources"> | |
270 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#killbehavior">killBehavior</a></p> | |
271 | <ul> | |
849e0547 | 272 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L30">src/worker/abstract-worker.ts:30</a></li> |
5ea22628 JB |
273 | </ul> |
274 | </aside> | |
275 | <div class="tsd-comment tsd-typography"> | |
276 | <div class="lead"> | |
277 | <p>The kill behavior set as option on the Worker constructor or a default value.</p> | |
278 | </div> | |
279 | </div> | |
280 | </section> | |
281 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
282 | <a name="lasttask" class="tsd-anchor"></a> | |
283 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> last<wbr>Task</h3> | |
284 | <div class="tsd-signature tsd-kind-icon">last<wbr>Task<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> | |
285 | <aside class="tsd-sources"> | |
286 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#lasttask">lastTask</a></p> | |
287 | <ul> | |
849e0547 | 288 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L38">src/worker/abstract-worker.ts:38</a></li> |
5ea22628 JB |
289 | </ul> |
290 | </aside> | |
291 | <div class="tsd-comment tsd-typography"> | |
292 | <div class="lead"> | |
293 | <p>Timestamp of the last task processed by this worker.</p> | |
294 | </div> | |
295 | </div> | |
296 | </section> | |
297 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
298 | <a name="mainworker" class="tsd-anchor"></a> | |
299 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagOptional">Optional</span> main<wbr>Worker</h3> | |
300 | <div class="tsd-signature tsd-kind-icon">main<wbr>Worker<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Worker</span></div> | |
301 | <aside class="tsd-sources"> | |
302 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#mainworker">mainWorker</a></p> | |
303 | </aside> | |
304 | </section> | |
305 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
306 | <a name="maxinactivetime" class="tsd-anchor"></a> | |
307 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> max<wbr>Inactive<wbr>Time</h3> | |
308 | <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> | |
309 | <aside class="tsd-sources"> | |
310 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#maxinactivetime">maxInactiveTime</a></p> | |
311 | <ul> | |
849e0547 | 312 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L26">src/worker/abstract-worker.ts:26</a></li> |
5ea22628 JB |
313 | </ul> |
314 | </aside> | |
315 | <div class="tsd-comment tsd-typography"> | |
316 | <div class="lead"> | |
317 | <p>The maximum time to keep this worker alive while idle. The pool automatically checks and terminates this worker when the time expires.</p> | |
318 | </div> | |
319 | </div> | |
320 | </section> | |
321 | <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> | |
322 | <a name="opts" class="tsd-anchor"></a> | |
323 | <h3><span class="tsd-flag ts-flagReadonly">Readonly</span> opts</h3> | |
324 | <div class="tsd-signature tsd-kind-icon">opts<span class="tsd-signature-symbol">:</span> <a href="../interfaces/workeroptions.html" class="tsd-signature-type" data-tsd-kind="Interface">WorkerOptions</a><span class="tsd-signature-symbol"> = ...</span></div> | |
325 | <aside class="tsd-sources"> | |
326 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#opts">opts</a></p> | |
327 | </aside> | |
328 | </section> | |
329 | </section> | |
330 | <section class="tsd-panel-group tsd-member-group "> | |
331 | <h2>Methods</h2> | |
332 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
333 | <a name="asyncid" class="tsd-anchor"></a> | |
334 | <h3>async<wbr>Id</h3> | |
335 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
336 | <li class="tsd-signature tsd-kind-icon">async<wbr>Id<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> | |
337 | </ul> | |
338 | <ul class="tsd-descriptions"> | |
339 | <li class="tsd-description"> | |
340 | <aside class="tsd-sources"> | |
341 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#asyncid">asyncId</a></p> | |
342 | <ul> | |
343 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:159</li> | |
344 | </ul> | |
345 | </aside> | |
346 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> | |
347 | <p>the unique ID assigned to this AsyncResource instance.</p> | |
348 | </li> | |
349 | </ul> | |
350 | </section> | |
351 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
352 | <a name="bind" class="tsd-anchor"></a> | |
353 | <h3>bind</h3> | |
354 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
355 | <li class="tsd-signature tsd-kind-icon">bind<Func><span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span>asyncResource<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AsyncResource</span><span class="tsd-signature-symbol"> }</span></li> | |
356 | </ul> | |
357 | <ul class="tsd-descriptions"> | |
358 | <li class="tsd-description"> | |
359 | <aside class="tsd-sources"> | |
360 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#bind">bind</a></p> | |
361 | <ul> | |
362 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:136</li> | |
363 | </ul> | |
364 | </aside> | |
365 | <div class="tsd-comment tsd-typography"> | |
366 | <div class="lead"> | |
367 | <p>Binds the given function to execute to this <code>AsyncResource</code>'s scope.</p> | |
368 | </div> | |
369 | </div> | |
370 | <h4 class="tsd-type-parameters-title">Type parameters</h4> | |
371 | <ul class="tsd-type-parameters"> | |
372 | <li> | |
373 | <h4>Func<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h4> | |
374 | </li> | |
375 | </ul> | |
376 | <h4 class="tsd-parameters-title">Parameters</h4> | |
377 | <ul class="tsd-parameters"> | |
378 | <li> | |
379 | <h5>fn: <span class="tsd-signature-type">Func</span></h5> | |
380 | <div class="tsd-comment tsd-typography"> | |
381 | <p>The function to bind to the current <code>AsyncResource</code>.</p> | |
382 | </div> | |
383 | </li> | |
384 | </ul> | |
385 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span>asyncResource<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AsyncResource</span><span class="tsd-signature-symbol"> }</span></h4> | |
386 | </li> | |
387 | </ul> | |
388 | </section> | |
389 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
390 | <a name="checkalive" class="tsd-anchor"></a> | |
391 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> check<wbr>Alive</h3> | |
392 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
393 | <li class="tsd-signature tsd-kind-icon">check<wbr>Alive<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> | |
394 | </ul> | |
395 | <ul class="tsd-descriptions"> | |
396 | <li class="tsd-description"> | |
397 | <aside class="tsd-sources"> | |
398 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#checkalive">checkAlive</a></p> | |
399 | <ul> | |
849e0547 | 400 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L130">src/worker/abstract-worker.ts:130</a></li> |
5ea22628 JB |
401 | </ul> |
402 | </aside> | |
403 | <div class="tsd-comment tsd-typography"> | |
404 | <div class="lead"> | |
405 | <p>Check to see if the worker should be terminated, because its living too long.</p> | |
406 | </div> | |
407 | </div> | |
408 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> | |
409 | </li> | |
410 | </ul> | |
411 | </section> | |
412 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
413 | <a name="emitdestroy" class="tsd-anchor"></a> | |
414 | <h3>emit<wbr>Destroy</h3> | |
415 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
416 | <li class="tsd-signature tsd-kind-icon">emit<wbr>Destroy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> | |
417 | </ul> | |
418 | <ul class="tsd-descriptions"> | |
419 | <li class="tsd-description"> | |
420 | <aside class="tsd-sources"> | |
421 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#emitdestroy">emitDestroy</a></p> | |
422 | <ul> | |
423 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:154</li> | |
424 | </ul> | |
425 | </aside> | |
426 | <div class="tsd-comment tsd-typography"> | |
427 | <div class="lead"> | |
428 | <p>Call AsyncHooks destroy callbacks.</p> | |
429 | </div> | |
430 | </div> | |
431 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> | |
432 | </li> | |
433 | </ul> | |
434 | </section> | |
435 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
436 | <a name="getmainworker" class="tsd-anchor"></a> | |
437 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> get<wbr>Main<wbr>Worker</h3> | |
438 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
439 | <li class="tsd-signature tsd-kind-icon">get<wbr>Main<wbr>Worker<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Worker</span></li> | |
440 | </ul> | |
441 | <ul class="tsd-descriptions"> | |
442 | <li class="tsd-description"> | |
443 | <aside class="tsd-sources"> | |
444 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#getmainworker">getMainWorker</a></p> | |
445 | <ul> | |
849e0547 | 446 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L113">src/worker/abstract-worker.ts:113</a></li> |
5ea22628 JB |
447 | </ul> |
448 | </aside> | |
449 | <div class="tsd-comment tsd-typography"> | |
450 | <div class="lead"> | |
451 | <p>Returns the main worker.</p> | |
452 | </div> | |
453 | </div> | |
454 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Worker</span></h4> | |
455 | <p>Reference to the main worker.</p> | |
456 | </li> | |
457 | </ul> | |
458 | </section> | |
459 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
460 | <a name="handleerror" class="tsd-anchor"></a> | |
461 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> handle<wbr>Error</h3> | |
462 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
463 | <li class="tsd-signature tsd-kind-icon">handle<wbr>Error<span class="tsd-signature-symbol">(</span>e<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li> | |
464 | </ul> | |
465 | <ul class="tsd-descriptions"> | |
466 | <li class="tsd-description"> | |
467 | <aside class="tsd-sources"> | |
468 | <p>Overrides <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#handleerror">handleError</a></p> | |
469 | <ul> | |
849e0547 | 470 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/cluster-worker.ts#L40">src/worker/cluster-worker.ts:40</a></li> |
5ea22628 JB |
471 | </ul> |
472 | </aside> | |
473 | <h4 class="tsd-parameters-title">Parameters</h4> | |
474 | <ul class="tsd-parameters"> | |
475 | <li> | |
476 | <h5>e: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span></h5> | |
477 | </li> | |
478 | </ul> | |
479 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4> | |
480 | </li> | |
481 | </ul> | |
482 | </section> | |
483 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
484 | <a name="run" class="tsd-anchor"></a> | |
485 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> run</h3> | |
486 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
487 | <li class="tsd-signature tsd-kind-icon">run<span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Response</span>, value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> | |
488 | </ul> | |
489 | <ul class="tsd-descriptions"> | |
490 | <li class="tsd-description"> | |
491 | <aside class="tsd-sources"> | |
492 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#run">run</a></p> | |
493 | <ul> | |
849e0547 | 494 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L152">src/worker/abstract-worker.ts:152</a></li> |
5ea22628 JB |
495 | </ul> |
496 | </aside> | |
497 | <div class="tsd-comment tsd-typography"> | |
498 | <div class="lead"> | |
499 | <p>Run the given function synchronously.</p> | |
500 | </div> | |
501 | </div> | |
502 | <h4 class="tsd-parameters-title">Parameters</h4> | |
503 | <ul class="tsd-parameters"> | |
504 | <li> | |
505 | <h5>fn: <span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Response</span></h5> | |
506 | <div class="tsd-comment tsd-typography"> | |
507 | <p>Function that will be executed.</p> | |
508 | </div> | |
509 | <ul class="tsd-parameters"> | |
510 | <li class="tsd-parameter-signature"> | |
511 | <ul class="tsd-signatures tsd-kind-type-literal"> | |
512 | <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Response</span></li> | |
513 | </ul> | |
514 | <ul class="tsd-descriptions"> | |
515 | <li class="tsd-description"> | |
516 | <h4 class="tsd-parameters-title">Parameters</h4> | |
517 | <ul class="tsd-parameters"> | |
518 | <li> | |
519 | <h5><span class="tsd-flag ts-flagOptional">Optional</span> data: <span class="tsd-signature-type">Data</span></h5> | |
520 | </li> | |
521 | </ul> | |
522 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Response</span></h4> | |
523 | </li> | |
524 | </ul> | |
525 | </li> | |
526 | </ul> | |
527 | </li> | |
528 | <li> | |
529 | <h5>value: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5> | |
530 | <div class="tsd-comment tsd-typography"> | |
531 | <p>Input data for the given function.</p> | |
532 | </div> | |
533 | </li> | |
534 | </ul> | |
535 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> | |
536 | </li> | |
537 | </ul> | |
538 | </section> | |
539 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
540 | <a name="runasync" class="tsd-anchor"></a> | |
541 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> run<wbr>Async</h3> | |
542 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
543 | <li class="tsd-signature tsd-kind-icon">run<wbr>Async<span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span>, value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> | |
544 | </ul> | |
545 | <ul class="tsd-descriptions"> | |
546 | <li class="tsd-description"> | |
547 | <aside class="tsd-sources"> | |
548 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#runasync">runAsync</a></p> | |
549 | <ul> | |
849e0547 | 550 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L173">src/worker/abstract-worker.ts:173</a></li> |
5ea22628 JB |
551 | </ul> |
552 | </aside> | |
553 | <div class="tsd-comment tsd-typography"> | |
554 | <div class="lead"> | |
555 | <p>Run the given function asynchronously.</p> | |
556 | </div> | |
557 | </div> | |
558 | <h4 class="tsd-parameters-title">Parameters</h4> | |
559 | <ul class="tsd-parameters"> | |
560 | <li> | |
561 | <h5>fn: <span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span></h5> | |
562 | <div class="tsd-comment tsd-typography"> | |
563 | <p>Function that will be executed.</p> | |
564 | </div> | |
565 | <ul class="tsd-parameters"> | |
566 | <li class="tsd-parameter-signature"> | |
567 | <ul class="tsd-signatures tsd-kind-type-literal"> | |
568 | <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span></li> | |
569 | </ul> | |
570 | <ul class="tsd-descriptions"> | |
571 | <li class="tsd-description"> | |
572 | <h4 class="tsd-parameters-title">Parameters</h4> | |
573 | <ul class="tsd-parameters"> | |
574 | <li> | |
575 | <h5><span class="tsd-flag ts-flagOptional">Optional</span> data: <span class="tsd-signature-type">Data</span></h5> | |
576 | </li> | |
577 | </ul> | |
578 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">></span></h4> | |
579 | </li> | |
580 | </ul> | |
581 | </li> | |
582 | </ul> | |
583 | </li> | |
584 | <li> | |
585 | <h5>value: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5> | |
586 | <div class="tsd-comment tsd-typography"> | |
587 | <p>Input data for the given function.</p> | |
588 | </div> | |
589 | </li> | |
590 | </ul> | |
591 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> | |
592 | </li> | |
593 | </ul> | |
594 | </section> | |
595 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
596 | <a name="runinasyncscope" class="tsd-anchor"></a> | |
597 | <h3>run<wbr>InAsync<wbr>Scope</h3> | |
598 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
599 | <li class="tsd-signature tsd-kind-icon">run<wbr>InAsync<wbr>Scope<This, Result><span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Result</span>, thisArg<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">This</span>, <span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Result</span></li> | |
600 | </ul> | |
601 | <ul class="tsd-descriptions"> | |
602 | <li class="tsd-description"> | |
603 | <aside class="tsd-sources"> | |
604 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#runinasyncscope">runInAsyncScope</a></p> | |
605 | <ul> | |
606 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:149</li> | |
607 | </ul> | |
608 | </aside> | |
609 | <div class="tsd-comment tsd-typography"> | |
610 | <div class="lead"> | |
611 | <p>Call the provided function with the provided arguments in the | |
612 | execution context of the async resource. This will establish the | |
613 | context, trigger the AsyncHooks before callbacks, call the function, | |
614 | trigger the AsyncHooks after callbacks, and then restore the original | |
615 | execution context.</p> | |
616 | </div> | |
617 | </div> | |
618 | <h4 class="tsd-type-parameters-title">Type parameters</h4> | |
619 | <ul class="tsd-type-parameters"> | |
620 | <li> | |
621 | <h4>This</h4> | |
622 | </li> | |
623 | <li> | |
624 | <h4>Result</h4> | |
625 | </li> | |
626 | </ul> | |
627 | <h4 class="tsd-parameters-title">Parameters</h4> | |
628 | <ul class="tsd-parameters"> | |
629 | <li> | |
630 | <h5>fn: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Result</span></h5> | |
631 | <div class="tsd-comment tsd-typography"> | |
632 | <p>The function to call in the execution context of this | |
633 | async resource.</p> | |
634 | </div> | |
635 | <ul class="tsd-parameters"> | |
636 | <li class="tsd-parameter-signature"> | |
637 | <ul class="tsd-signatures tsd-kind-type-literal tsd-is-external"> | |
638 | <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Result</span></li> | |
639 | </ul> | |
640 | <ul class="tsd-descriptions"> | |
641 | <li class="tsd-description"> | |
642 | <h4 class="tsd-parameters-title">Parameters</h4> | |
643 | <ul class="tsd-parameters"> | |
644 | <li> | |
645 | <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> | |
646 | </li> | |
647 | </ul> | |
648 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Result</span></h4> | |
649 | </li> | |
650 | </ul> | |
651 | </li> | |
652 | </ul> | |
653 | </li> | |
654 | <li> | |
655 | <h5><span class="tsd-flag ts-flagOptional">Optional</span> thisArg: <span class="tsd-signature-type">This</span></h5> | |
656 | <div class="tsd-comment tsd-typography"> | |
657 | <p>The receiver to be used for the function call.</p> | |
658 | </div> | |
659 | </li> | |
660 | <li> | |
661 | <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> | |
662 | <div class="tsd-comment tsd-typography"> | |
663 | <p>Optional arguments to pass to the function.</p> | |
664 | </div> | |
665 | </li> | |
666 | </ul> | |
667 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Result</span></h4> | |
668 | </li> | |
669 | </ul> | |
670 | </section> | |
671 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
672 | <a name="sendtomainworker" class="tsd-anchor"></a> | |
673 | <h3><span class="tsd-flag ts-flagProtected">Protected</span> send<wbr>ToMain<wbr>Worker</h3> | |
674 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
675 | <li class="tsd-signature tsd-kind-icon">send<wbr>ToMain<wbr>Worker<span class="tsd-signature-symbol">(</span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> | |
676 | </ul> | |
677 | <ul class="tsd-descriptions"> | |
678 | <li class="tsd-description"> | |
679 | <aside class="tsd-sources"> | |
680 | <p>Overrides <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#sendtomainworker">sendToMainWorker</a></p> | |
681 | <ul> | |
849e0547 | 682 | <li>Defined in <a href="https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/cluster-worker.ts#L36">src/worker/cluster-worker.ts:36</a></li> |
5ea22628 JB |
683 | </ul> |
684 | </aside> | |
685 | <h4 class="tsd-parameters-title">Parameters</h4> | |
686 | <ul class="tsd-parameters"> | |
687 | <li> | |
688 | <h5>message: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5> | |
689 | </li> | |
690 | </ul> | |
691 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> | |
692 | </li> | |
693 | </ul> | |
694 | </section> | |
695 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
696 | <a name="triggerasyncid" class="tsd-anchor"></a> | |
697 | <h3>trigger<wbr>Async<wbr>Id</h3> | |
698 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
699 | <li class="tsd-signature tsd-kind-icon">trigger<wbr>Async<wbr>Id<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> | |
700 | </ul> | |
701 | <ul class="tsd-descriptions"> | |
702 | <li class="tsd-description"> | |
703 | <aside class="tsd-sources"> | |
704 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#triggerasyncid">triggerAsyncId</a></p> | |
705 | <ul> | |
706 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:164</li> | |
707 | </ul> | |
708 | </aside> | |
709 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> | |
710 | <p>the trigger ID for this AsyncResource instance.</p> | |
711 | </li> | |
712 | </ul> | |
713 | </section> | |
714 | <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external"> | |
715 | <a name="bind-1" class="tsd-anchor"></a> | |
716 | <h3><span class="tsd-flag ts-flagStatic">Static</span> bind</h3> | |
717 | <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external"> | |
718 | <li class="tsd-signature tsd-kind-icon">bind<Func><span class="tsd-signature-symbol">(</span>fn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Func</span>, type<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span>asyncResource<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AsyncResource</span><span class="tsd-signature-symbol"> }</span></li> | |
719 | </ul> | |
720 | <ul class="tsd-descriptions"> | |
721 | <li class="tsd-description"> | |
722 | <aside class="tsd-sources"> | |
723 | <p>Inherited from <a href="abstractworker.html">AbstractWorker</a>.<a href="abstractworker.html#bind-1">bind</a></p> | |
724 | <ul> | |
725 | <li>Defined in node_modules/@types/node/async_hooks.d.ts:130</li> | |
726 | </ul> | |
727 | </aside> | |
728 | <div class="tsd-comment tsd-typography"> | |
729 | <div class="lead"> | |
730 | <p>Binds the given function to the current execution context.</p> | |
731 | </div> | |
732 | </div> | |
733 | <h4 class="tsd-type-parameters-title">Type parameters</h4> | |
734 | <ul class="tsd-type-parameters"> | |
735 | <li> | |
736 | <h4>Func<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h4> | |
737 | </li> | |
738 | </ul> | |
739 | <h4 class="tsd-parameters-title">Parameters</h4> | |
740 | <ul class="tsd-parameters"> | |
741 | <li> | |
742 | <h5>fn: <span class="tsd-signature-type">Func</span></h5> | |
743 | <div class="tsd-comment tsd-typography"> | |
744 | <p>The function to bind to the current execution context.</p> | |
745 | </div> | |
746 | </li> | |
747 | <li> | |
748 | <h5><span class="tsd-flag ts-flagOptional">Optional</span> type: <span class="tsd-signature-type">string</span></h5> | |
749 | <div class="tsd-comment tsd-typography"> | |
750 | <p>An optional name to associate with the underlying <code>AsyncResource</code>.</p> | |
751 | </div> | |
752 | </li> | |
753 | </ul> | |
754 | <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span>asyncResource<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AsyncResource</span><span class="tsd-signature-symbol"> }</span></h4> | |
755 | </li> | |
756 | </ul> | |
757 | </section> | |
758 | </section> | |
759 | </div> | |
760 | <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> | |
761 | <nav class="tsd-navigation primary"> | |
762 | <ul> | |
763 | <li class=" "> | |
764 | <a href="../index.html">Exports</a> | |
765 | </li> | |
766 | </ul> | |
767 | </nav> | |
768 | <nav class="tsd-navigation secondary menu-sticky"> | |
769 | <ul class="before-current"> | |
770 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
771 | <a href="abstractworker.html" class="tsd-kind-icon">Abstract<wbr>Worker</a> | |
772 | </li> | |
773 | </ul> | |
774 | <ul class="current"> | |
775 | <li class="current tsd-kind-class tsd-has-type-parameter"> | |
776 | <a href="clusterworker.html" class="tsd-kind-icon">Cluster<wbr>Worker</a> | |
777 | <ul> | |
778 | <li class=" tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited"> | |
779 | <a href="clusterworker.html#constructor" class="tsd-kind-icon">constructor</a> | |
780 | </li> | |
781 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
782 | <a href="clusterworker.html#async" class="tsd-kind-icon">async</a> | |
783 | </li> | |
784 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
785 | <a href="clusterworker.html#interval" class="tsd-kind-icon">interval</a> | |
786 | </li> | |
787 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
788 | <a href="clusterworker.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a> | |
789 | </li> | |
790 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
791 | <a href="clusterworker.html#lasttask" class="tsd-kind-icon">last<wbr>Task</a> | |
792 | </li> | |
793 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
794 | <a href="clusterworker.html#mainworker" class="tsd-kind-icon">main<wbr>Worker</a> | |
795 | </li> | |
796 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
797 | <a href="clusterworker.html#maxinactivetime" class="tsd-kind-icon">max<wbr>Inactive<wbr>Time</a> | |
798 | </li> | |
799 | <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited"> | |
800 | <a href="clusterworker.html#opts" class="tsd-kind-icon">opts</a> | |
801 | </li> | |
802 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
803 | <a href="clusterworker.html#asyncid" class="tsd-kind-icon">async<wbr>Id</a> | |
804 | </li> | |
805 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
806 | <a href="clusterworker.html#bind" class="tsd-kind-icon">bind</a> | |
807 | </li> | |
808 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
809 | <a href="clusterworker.html#checkalive" class="tsd-kind-icon">check<wbr>Alive</a> | |
810 | </li> | |
811 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
812 | <a href="clusterworker.html#emitdestroy" class="tsd-kind-icon">emit<wbr>Destroy</a> | |
813 | </li> | |
814 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
815 | <a href="clusterworker.html#getmainworker" class="tsd-kind-icon">get<wbr>Main<wbr>Worker</a> | |
816 | </li> | |
817 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
818 | <a href="clusterworker.html#handleerror" class="tsd-kind-icon">handle<wbr>Error</a> | |
819 | </li> | |
820 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
821 | <a href="clusterworker.html#run" class="tsd-kind-icon">run</a> | |
822 | </li> | |
823 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"> | |
824 | <a href="clusterworker.html#runasync" class="tsd-kind-icon">run<wbr>Async</a> | |
825 | </li> | |
826 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"> | |
827 | <a href="clusterworker.html#runinasyncscope" class="tsd-kind-icon">run<wbr>InAsync<wbr>Scope</a> | |
828 | </li> | |
829 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> | |
830 | <a href="clusterworker.html#sendtomainworker" class="tsd-kind-icon">send<wbr>ToMain<wbr>Worker</a> | |
831 | </li> | |
832 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"> | |
833 | <a href="clusterworker.html#triggerasyncid" class="tsd-kind-icon">trigger<wbr>Async<wbr>Id</a> | |
834 | </li> | |
835 | <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external"> | |
836 | <a href="clusterworker.html#bind-1" class="tsd-kind-icon">bind</a> | |
837 | </li> | |
838 | </ul> | |
839 | </li> | |
840 | </ul> | |
841 | <ul class="after-current"> | |
842 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
843 | <a href="dynamicclusterpool.html" class="tsd-kind-icon">Dynamic<wbr>Cluster<wbr>Pool</a> | |
844 | </li> | |
845 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
846 | <a href="dynamicthreadpool.html" class="tsd-kind-icon">Dynamic<wbr>Thread<wbr>Pool</a> | |
847 | </li> | |
848 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
849 | <a href="fixedclusterpool.html" class="tsd-kind-icon">Fixed<wbr>Cluster<wbr>Pool</a> | |
850 | </li> | |
851 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
852 | <a href="fixedthreadpool.html" class="tsd-kind-icon">Fixed<wbr>Thread<wbr>Pool</a> | |
853 | </li> | |
854 | <li class=" tsd-kind-class tsd-has-type-parameter"> | |
855 | <a href="threadworker.html" class="tsd-kind-icon">Thread<wbr>Worker</a> | |
856 | </li> | |
857 | <li class=" tsd-kind-interface"> | |
858 | <a href="../interfaces/clusterpooloptions.html" class="tsd-kind-icon">Cluster<wbr>Pool<wbr>Options</a> | |
859 | </li> | |
860 | <li class=" tsd-kind-interface tsd-has-type-parameter"> | |
861 | <a href="../interfaces/ipool.html" class="tsd-kind-icon">IPool</a> | |
862 | </li> | |
863 | <li class=" tsd-kind-interface"> | |
864 | <a href="../interfaces/iworker.html" class="tsd-kind-icon">IWorker</a> | |
865 | </li> | |
866 | <li class=" tsd-kind-interface tsd-has-type-parameter"> | |
867 | <a href="../interfaces/pooloptions.html" class="tsd-kind-icon">Pool<wbr>Options</a> | |
868 | </li> | |
869 | <li class=" tsd-kind-interface"> | |
870 | <a href="../interfaces/workeroptions.html" class="tsd-kind-icon">Worker<wbr>Options</a> | |
871 | </li> | |
872 | <li class=" tsd-kind-type-alias tsd-has-type-parameter"> | |
873 | <a href="../index.html#errorhandler" class="tsd-kind-icon">Error<wbr>Handler</a> | |
874 | </li> | |
875 | <li class=" tsd-kind-type-alias tsd-has-type-parameter"> | |
876 | <a href="../index.html#exithandler" class="tsd-kind-icon">Exit<wbr>Handler</a> | |
877 | </li> | |
878 | <li class=" tsd-kind-type-alias"> | |
879 | <a href="../index.html#killbehavior" class="tsd-kind-icon">Kill<wbr>Behavior</a> | |
880 | </li> | |
881 | <li class=" tsd-kind-type-alias tsd-has-type-parameter"> | |
882 | <a href="../index.html#onlinehandler" class="tsd-kind-icon">Online<wbr>Handler</a> | |
883 | </li> | |
884 | <li class=" tsd-kind-type-alias"> | |
885 | <a href="../index.html#threadworkerwithmessagechannel" class="tsd-kind-icon">Thread<wbr>Worker<wbr>With<wbr>Message<wbr>Channel</a> | |
886 | </li> | |
887 | <li class=" tsd-kind-type-alias"> | |
888 | <a href="../index.html#workerchoicestrategy" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategy</a> | |
889 | </li> | |
890 | <li class=" tsd-kind-variable"> | |
891 | <a href="../index.html#killbehaviors" class="tsd-kind-icon">Kill<wbr>Behaviors</a> | |
892 | </li> | |
893 | <li class=" tsd-kind-variable"> | |
894 | <a href="../index.html#workerchoicestrategies" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategies</a> | |
895 | </li> | |
896 | </ul> | |
897 | </nav> | |
898 | </div> | |
899 | </div> | |
900 | </div> | |
901 | <footer class="with-border-bottom"> | |
902 | <div class="container"> | |
903 | <h2>Legend</h2> | |
904 | <div class="tsd-legend-group"> | |
905 | <ul class="tsd-legend"> | |
906 | <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li> | |
907 | <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li> | |
908 | </ul> | |
909 | <ul class="tsd-legend"> | |
910 | <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li> | |
911 | <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li> | |
912 | </ul> | |
913 | <ul class="tsd-legend"> | |
914 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li> | |
915 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li> | |
916 | </ul> | |
917 | <ul class="tsd-legend"> | |
918 | <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li> | |
919 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li> | |
920 | </ul> | |
921 | <ul class="tsd-legend"> | |
922 | <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li> | |
923 | </ul> | |
924 | </div> | |
925 | </div> | |
926 | </footer> | |
927 | <div class="container tsd-generator"> | |
928 | <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p> | |
929 | </div> | |
930 | <div class="overlay"></div> | |
931 | <script src="../assets/js/main.js"></script> | |
932 | </body> | |
933 | </html> |