Skip to content

Commit 7bd2a2e

Browse files
committed
1 parent 93720d8 commit 7bd2a2e

19 files changed

+299
-277
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Version 0.24.2
2+
3+
## Fixes
4+
5+
_Things that were broken and are now fixed._
6+
7+
- The example code in `example` is updated to remove a deprecated method. See [#185](https://github.com/zeebe-io/zeebe-client-node-js/issues/185).
8+
- An race condition in the ZBBatchWorker that could cause jobs to be lost in certain specific and rare race conditions has been refactored. See [#177](https://github.com/zeebe-io/zeebe-client-node-js/issues/177)
9+
- The `onConnectionError` event is now debounced. See [#161](https://github.com/zeebe-io/zeebe-client-node-js/issues/161).
10+
111
# Version 0.24.0
212

313
## Fixes

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zeebe-node",
3-
"version": "v0.24.1",
3+
"version": "v0.24.2",
44
"description": "A Node.js client library for the Zeebe Microservices Orchestration Engine.",
55
"keywords": [
66
"zeebe",
@@ -100,7 +100,7 @@
100100
"tslint-config-prettier": "^1.18.0",
101101
"typedoc": "^0.16.0",
102102
"typedoc-plugin-sourcefile-url": "^1.0.6",
103-
"typescript": "^3.8.3"
103+
"typescript": "^3.9.7"
104104
},
105105
"author": {
106106
"name": "Josh Wulf",

pnpm-lock.yaml

+26-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/disconnection/disconnect.spec.ts

+54-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// tslint:disable-next-line: no-implicit-dependencies
2-
import { GenericContainer } from '@sitapati/testcontainers'
2+
import { GenericContainer, Wait } from '@sitapati/testcontainers'
33
import { ZBClient } from '../..'
4-
// import { createUniqueTaskType } from '../../lib/createUniqueTaskType'
54

65
process.env.ZEEBE_NODE_LOG_LEVEL = process.env.ZEEBE_NODE_LOG_LEVEL || 'NONE'
76

@@ -14,45 +13,66 @@ let worker
1413

1514
afterEach(async () => {
1615
await container?.stop()
17-
await worker?.stop()
16+
await worker?.close()
1817
})
1918

2019
test('reconnects after a pod reschedule', async done => {
20+
let readyCount = 0
21+
let errorCount = 0
2122
const delay = timeout =>
2223
new Promise(res => setTimeout(() => res(), timeout))
2324

25+
// tslint:disable-next-line: no-console
26+
console.log('##### Starting container') // @DEBUG
27+
2428
container = await new GenericContainer(
2529
'camunda/zeebe',
2630
ZEEBE_DOCKER_TAG,
2731
undefined,
2832
26500
2933
)
3034
.withExposedPorts(26500)
35+
.withWaitStrategy(Wait.forLogMessage('Bootstrap Broker-0 succeeded.'))
3136
.start()
3237

3338
await delay(10000)
3439

3540
const zbc = new ZBClient(`localhost`)
3641
await zbc.deployWorkflow('./src/__tests__/testdata/disconnection.bpmn')
37-
worker = zbc.createWorker({
38-
taskHandler: (_, complete) => {
39-
complete.success()
40-
},
41-
taskType: 'disconnection-task',
42+
worker = zbc
43+
.createWorker({
44+
taskHandler: (_, complete) => {
45+
complete.success()
46+
},
47+
taskType: 'disconnection-task',
48+
})
49+
.on('connectionError', () => {
50+
errorCount++
51+
})
52+
.on('ready', () => {
53+
readyCount++
54+
})
55+
56+
// tslint:disable-next-line: no-console
57+
console.log('##### Deploying workflow') // @DEBUG
58+
59+
const wf = await zbc.createWorkflowInstanceWithResult({
60+
bpmnProcessId: 'disconnection',
61+
requestTimeout: 25000,
62+
variables: {},
4263
})
43-
const wf = await zbc.createWorkflowInstanceWithResult('disconnection', {})
4464
expect(wf.bpmnProcessId).toBeTruthy()
4565

4666
// tslint:disable-next-line: no-console
47-
// console.log('##### Stopping container...') // @DEBUG
67+
console.log('##### Stopping container...') // @DEBUG
4868

4969
await container.stop()
5070

5171
// tslint:disable-next-line: no-console
52-
// console.log('##### Container stopped.') // @DEBUG
72+
console.log('##### Container stopped.') // @DEBUG
5373

5474
// tslint:disable-next-line: no-console
55-
// console.log('##### Starting container....') // @DEBUG
75+
console.log('##### Starting container....') // @DEBUG
5676

5777
container = await new GenericContainer(
5878
'camunda/zeebe',
@@ -61,6 +81,7 @@ test('reconnects after a pod reschedule', async done => {
6181
26500
6282
)
6383
.withExposedPorts(26500)
84+
.withWaitStrategy(Wait.forLogMessage('Bootstrap Broker-0 succeeded.'))
6485
.start()
6586

6687
// tslint:disable-next-line: no-console
@@ -75,20 +96,32 @@ test('reconnects after a pod reschedule', async done => {
7596
await container.stop()
7697
container = undefined
7798
worker = undefined
99+
expect(readyCount).toBe(2)
100+
expect(errorCount).toBe(1)
78101
done()
79102
})
80103

81104
test('a worker that started first, connects to a broker that starts later', async done => {
105+
let readyCount = 0
106+
let errorCount = 0
107+
82108
const delay = timeout =>
83109
new Promise(res => setTimeout(() => res(), timeout))
84110

85111
const zbc = new ZBClient(`localhost`)
86-
worker = zbc.createWorker({
87-
taskHandler: (_, complete) => {
88-
complete.success()
89-
},
90-
taskType: 'disconnection-task',
91-
})
112+
worker = zbc
113+
.createWorker({
114+
taskHandler: (_, complete) => {
115+
complete.success()
116+
},
117+
taskType: 'disconnection-task',
118+
})
119+
.on('connectionError', () => {
120+
errorCount++
121+
})
122+
.on('ready', () => {
123+
readyCount++
124+
})
92125

93126
container = await new GenericContainer(
94127
'camunda/zeebe',
@@ -97,6 +130,7 @@ test('a worker that started first, connects to a broker that starts later', asyn
97130
26500
98131
)
99132
.withExposedPorts(26500)
133+
.withWaitStrategy(Wait.forLogMessage('Bootstrap Broker-0 succeeded.'))
100134
.start()
101135

102136
await delay(10000)
@@ -109,5 +143,7 @@ test('a worker that started first, connects to a broker that starts later', asyn
109143
await container.stop()
110144
container = undefined
111145
worker = undefined
146+
expect(readyCount).toBe(1)
147+
expect(errorCount).toBe(1)
112148
done()
113149
})

0 commit comments

Comments
 (0)