Skip to content

Commit

Permalink
Resolving spawn function, removed deprecated extractor state field (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
radovan-jorgic authored Nov 21, 2024
1 parent 05206f2 commit 427eb4b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Release Notes

#### v1.0.1

- Bug fixes and improvements in logging.

#### v1.0.0

- Allow extractions to use full lambda runtime and gracefully handle execution context timeout.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devrev/ts-adaas",
"version": "1.0.0",
"version": "1.0.1",
"description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
3 changes: 0 additions & 3 deletions src/tests/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ export function createEvent({
error,
delay,
},
extractor_state: {
test_extractor_state_key: 'test_extractor_state_value',
},
...payloadOverrides,
},
execution_metadata: {
Expand Down
1 change: 0 additions & 1 deletion src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface LogRecord {
*/
export interface AdapterUpdateParams {
artifact?: Artifact;
extractor_state?: object;
}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/types/extraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ export interface AirdropMessage {
event_context: EventContextIn;
event_type: EventType;
event_data?: EventData;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
extractor_state?: any;
}

/**
Expand All @@ -171,6 +169,5 @@ export interface AirdropMessage {
export interface ExtractorEvent {
event_type: string;
event_context: EventContextOut;
extractor_state?: string;
event_data?: EventData;
}
3 changes: 2 additions & 1 deletion src/workers/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ export class Spawn {
this.logger.info('Worker exited with exit code: ' + code + '.');
if (this.timer) {
clearTimeout(this.timer);
await this.exitFromMainThread();
}
await this.exitFromMainThread();
});
worker.on(WorkerEvent.WorkerMessage, async (message) => {
if (message?.subject === WorkerMessageSubject.WorkerMessageEmitted) {
Expand All @@ -173,6 +173,7 @@ export class Spawn {

private async exitFromMainThread(): Promise<void> {
if (this.hasWorkerEmitted) {
this.resolve(true);
return;
}

Expand Down

0 comments on commit 427eb4b

Please sign in to comment.