elasticio-sailor-nodejs 3.0.0-dev4 → 3.0.0-dev5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config/local.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "LOG_LEVEL": "trace",
3
- "ELASTICIO_FLOW_ID": "697b56aca8e2e9b35e1952da",
3
+ "ELASTICIO_FLOW_ID": "692ee23d4ab5d34bb7321559",
4
4
  "ELASTICIO_EXEC_ID": "exec_67890",
5
5
  "ELASTICIO_STEP_ID": "step_1",
6
6
  "ELASTICIO_CONTAINER_ID": "container_abcde",
@@ -9,11 +9,11 @@
9
9
  "ELASTICIO_COMP_ID": "component_3344",
10
10
  "ELASTICIO_FUNCTION": "data_trigger",
11
11
  "ELASTICIO_API_URI": "http://localhost:9000",
12
- "ELASTICIO_API_USERNAME": "task-697b56aca8e2e9b35e1952da",
13
- "ELASTICIO_API_KEY": "9b2e0465-b00c-4b57-af91-bfc3a830306c",
12
+ "ELASTICIO_API_USERNAME": "task-692ee23d4ab5d34bb7321559",
13
+ "ELASTICIO_API_KEY": "976ffec8-455b-494e-9478-2d66761f4040",
14
14
  "ELASTICIO_MESSAGE_CRYPTO_IV": "0.03091345790184",
15
15
  "ELASTICIO_MESSAGE_CRYPTO_PASSWORD": "password",
16
- "ELASTICIO_SAILOR_PROXY_URI": "http://localhost:4001",
16
+ "ELASTICIO_SAILOR_PROXY_URI": "http://localhost:5001",
17
17
  "ELASTICIO_COMPONENT_PATH": "./spec/component",
18
18
  "ELASTICIO_EMIT_LIGHTWEIGHT_MESSAGE": "true"
19
19
  }
@@ -202,6 +202,7 @@ class ProxyClient {
202
202
  return resolve();
203
203
  }
204
204
 
205
+ // TODO: what if incoming message is received during graceful shutdown?
205
206
  this.clientSession.close(() => {
206
207
  log.debug('Successfully closed HTTP2 connection');
207
208
  resolve();
package/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ node = "18.16.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elasticio-sailor-nodejs",
3
3
  "description": "The official elastic.io library for bootstrapping and executing for Node.js connectors",
4
- "version": "3.0.0-dev4",
4
+ "version": "3.0.0-dev5",
5
5
  "main": "run.js",
6
6
  "scripts": {
7
7
  "build": "tsc",
package/run.js CHANGED
@@ -57,23 +57,6 @@ async function putOutToSea(settings, ipc) {
57
57
  ipc.send('init:ended');
58
58
  }
59
59
 
60
- async function disconnectAndExit() {
61
- if (!disconnectRequired) {
62
- return;
63
- }
64
- disconnectRequired = false;
65
-
66
- try {
67
- logger.info('Disconnecting...');
68
- await sailor.disconnect();
69
- logger.info('Successfully disconnected');
70
- process.exit();
71
- } catch (err) {
72
- logger.error(err, 'Unable to disconnect');
73
- process.exit(-1);
74
- }
75
- }
76
-
77
60
  async function gracefulShutdown() {
78
61
  if (!disconnectRequired) {
79
62
  return;
@@ -90,8 +73,15 @@ async function gracefulShutdown() {
90
73
  await sailorInit;
91
74
  logger.trace('Waited an init before graceful shutdown');
92
75
 
93
- await sailor.scheduleShutdown();
94
- await disconnectAndExit();
76
+ try {
77
+ logger.info('Disconnecting...');
78
+ await sailor.scheduleShutdown();
79
+ logger.info('Successfully disconnected');
80
+ process.exit();
81
+ } catch (err) {
82
+ logger.error(err, 'Unable to disconnect');
83
+ process.exit(-1);
84
+ }
95
85
  }
96
86
 
97
87
  async function run(settings, ipc) {