@outputai/core 0.13.0 → 0.13.1-next.318b2e6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/core",
3
- "version": "0.13.0",
3
+ "version": "0.13.1-next.318b2e6.0",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import { Worker, NativeConnection, GracefulShutdownPeriodExpiredError } from '@temporalio/worker';
1
+ import { Worker, NativeConnection } from '@temporalio/worker';
2
2
  import * as configs from './configs.js';
3
3
  import { loadActivities } from './loader/activities.js';
4
4
  import { loadWorkflows } from './loader/workflows.js';
@@ -174,11 +174,10 @@ execute()
174
174
  log.info( 'Flushing hook callbacks...' );
175
175
  await flushPendingHooks( hookFlushTimeoutMs );
176
176
 
177
- // An expired drain is the bound working as intended, not a worker failure, so it keeps exit code 0.
178
- const workerFailedToStop = shutdownFailures.some( v => v.service === 'worker' && !( v.error instanceof GracefulShutdownPeriodExpiredError ) );
177
+ const workerFailedToStop = shutdownFailures.some( v => v.service === 'worker' );
179
178
  const exitCode = workerFailedToStop || hasError ? 1 : 0;
180
179
  setTimeout( () => {
181
- log.info( 'Bye' );
180
+ log.info( 'Bye', { exitCode } );
182
181
  process.exit( exitCode );
183
182
  } );
184
183
  } );
@@ -8,7 +8,6 @@ const {
8
8
  connectionMonitorInstance,
9
9
  createCatalogMock,
10
10
  flushPendingHooksMock,
11
- GracefulShutdownPeriodExpiredError,
12
11
  hashSourceCodeMock,
13
12
  initInterceptorsMock,
14
13
  interruption,
@@ -118,11 +117,6 @@ const {
118
117
  name = 'UncaughtError';
119
118
  };
120
119
 
121
- /** Stands in for the Temporal error thrown when the drain outlives the force time */
122
- class GracefulShutdownPeriodExpiredError extends Error {
123
- name = 'GracefulShutdownPeriodExpiredError';
124
- };
125
-
126
120
  const interruption = { controller: null, KillSignError, UncaughtError };
127
121
 
128
122
  return {
@@ -132,7 +126,6 @@ const {
132
126
  connectionMonitorInstance,
133
127
  createCatalogMock: vi.fn().mockReturnValue( { workflowNames: [ 'demo' ] } ),
134
128
  flushPendingHooksMock: vi.fn().mockResolvedValue( undefined ),
135
- GracefulShutdownPeriodExpiredError,
136
129
  hashSourceCodeMock: vi.fn().mockResolvedValue( 'catalog-hash' ),
137
130
  initInterceptorsMock: vi.fn().mockReturnValue( [] ),
138
131
  interruption,
@@ -204,8 +197,7 @@ vi.mock( './catalog_workflow/catalog_publisher.js', () => ( {
204
197
  vi.mock( './shutdown.js', () => ( { shutdownServices: shutdownServicesMock } ) );
205
198
  vi.mock( '@temporalio/worker', () => ( {
206
199
  NativeConnection: { connect: vi.fn().mockResolvedValue( mockConnection ) },
207
- Worker: { create: vi.fn().mockResolvedValue( mockWorker ) },
208
- GracefulShutdownPeriodExpiredError
200
+ Worker: { create: vi.fn().mockResolvedValue( mockWorker ) }
209
201
  } ) );
210
202
 
211
203
  const importWorker = async () => {
@@ -397,7 +389,7 @@ describe( 'worker/index', () => {
397
389
  } );
398
390
  expect( mockLog.error ).not.toHaveBeenCalled();
399
391
  expect( mainEventBusMock.emit ).not.toHaveBeenCalledWith( BusEventType.RUNTIME_ERROR, expect.anything() );
400
- expect( mockLog.info ).toHaveBeenCalledWith( 'Bye' );
392
+ expect( mockLog.info ).toHaveBeenCalledWith( 'Bye', { exitCode: 0 } );
401
393
  expect( process.exit ).toHaveBeenCalledWith( 0 );
402
394
  } );
403
395
 
@@ -412,18 +404,6 @@ describe( 'worker/index', () => {
412
404
  expect( process.exit ).toHaveBeenCalledWith( 0 );
413
405
  } );
414
406
 
415
- it( 'still exits cleanly when the drain outlived the force time', async () => {
416
- await bootWorker();
417
- const error = new GracefulShutdownPeriodExpiredError( 'Timed out while waiting for worker to shutdown gracefully' );
418
- shutdownServicesMock.mockResolvedValueOnce( [ { service: 'worker', error } ] );
419
-
420
- interruption.controller.abort( new interruption.KillSignError( 'SIGTERM' ) );
421
- await waitForExit();
422
-
423
- expect( mockLog.error ).not.toHaveBeenCalled();
424
- expect( process.exit ).toHaveBeenCalledWith( 0 );
425
- } );
426
-
427
407
  it( 'does not report the worker as terminated when a signal ended the run', async () => {
428
408
  await bootWorker();
429
409
 
@@ -482,7 +462,6 @@ describe( 'worker/index', () => {
482
462
 
483
463
  expect( process.exit ).toHaveBeenCalledWith( 1 );
484
464
  } );
485
-
486
465
  it( 'reports a lost connection and shuts down', async () => {
487
466
  const error = new Error( 'connection lost' );
488
467
  await bootWorker();