Skip to content

fix: throw an error instead of ignoring it when uploading batches#207

Open
gasperzgonec wants to merge 6 commits into
mainfrom
gasperz/ASCPT-28
Open

fix: throw an error instead of ignoring it when uploading batches#207
gasperzgonec wants to merge 6 commits into
mainfrom
gasperz/ASCPT-28

Conversation

@gasperzgonec

Copy link
Copy Markdown
Contributor

Description

Connected Issues

Checklist

  • Tests added/updated and ran with npm run test OR no tests needed.
  • Ran backwards compatibility tests with npm run test:backwards-compatibility.
  • Code formatted and checked with npm run lint.
  • Tested airdrop-template linked to this PR.
  • Documentation updated and provided a link to PR / new docs OR no docs needed.

@gasperzgonec gasperzgonec requested review from a team and radovanjorgic as code owners June 4, 2026 08:16
Comment thread src/repo/repo.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/http/axios-client-internal.ts Outdated
@radovanjorgic radovanjorgic changed the title fix: Throw an error instead of ignoring it when uploading batches fix: throw an error instead of ignoring it when uploading batches Jun 11, 2026
Comment thread src/multithreading/spawn/spawn.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/repo/repo.ts
Comment thread src/tests/upload-failure/slow-env.setup.ts Outdated
Comment thread src/types/workers.ts Outdated
Comment thread src/types/workers.ts Outdated
@github-actions

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

const isSdkLog = message.payload?.isSdkLog ?? true;
this.logger.logFn(stringifiedArgs, level, isSdkLog);
if (typeof this.logger?.logFn === 'function') {
this.logger.logFn(stringifiedArgs, level, isSdkLog);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why was this needed? Isn't logFn always a function?

console.log(
`Uploading all repos before emitting event with event type: ${newEventType}.`
);
const canEmit = await this.beforeEmit(newEventType);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canEmit calls the beforeEmit function (confusing)? And if it returns false what happens?

parentPort?.postMessage(WorkerMessageSubject.WorkerMessageExit);
this.hasWorkerEmitted = true;
const payload = this.buildEmitPayload(newEventType, data);
const sent = await this.sendToPlatform(newEventType, payload);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is a bit strange here IMO, can we find better name for sendToPlatform? And again, if it fails we just return, is that correct?

Maybe we could move the actual emit function here, so we have beforeEmit, actual emit logic and afterEmit in this exposed method.

} catch (error) {
console.error('Error while uploading repos', error);
for (const repo of this.repos) {
this.artifacts = [...this.artifacts, ...repo.uploadedArtifacts];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of this on error? We extend the artifacts array with repo.uploadedArtifacts? Can you explain?

const { eventType: errorEventType } = getTimeoutErrorEventType(
this.event.payload.event_type
);
await this.emitUploadFailure(errorEventType, error);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious if we need separate function for this.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants