Skip to content

Commit 14f9359

Browse files
authored
feat: add batch reprocess support (#107)
1 parent 8718679 commit 14f9359

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/crash/crash-api-client/crash-api-client.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe('CrashApiClient', () => {
166166
await client.reprocessCrash(database, 0);
167167
fail('reprocessCrash was supposed to throw!');
168168
} catch (error: any) {
169-
expect(error.message).toMatch(/to be a positive non-zero number/);
169+
expect(error.message).toMatch(/to be positive non-zero numbers/);
170170
}
171171
});
172172
});

src/crash/crash-api-client/crash-api-client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ export class CrashApiClient {
3737
}
3838

3939
async reprocessCrash(database: string, crashId: number, force = false, processor = ''): Promise<SuccessResponse> {
40+
return this.reprocessCrashes(database, [crashId], force, processor);
41+
}
42+
43+
async reprocessCrashes(database: string, crashIds: Array<number>, force = false, processor = ''): Promise<SuccessResponse> {
4044
ac.assertNonWhiteSpaceString(database, 'database');
4145
ac.assertBoolean(force, 'force');
42-
if (crashId <= 0) {
43-
throw new Error(`Expected id to be a positive non-zero number. Value received: "${crashId}"`);
46+
47+
for (const crashId of crashIds) {
48+
if (crashId <= 0) {
49+
throw new Error(`Expected ids to be positive non-zero numbers. Value received: "${crashId}"`);
50+
}
4451
}
4552

4653
const formData = this._client.createFormData();
4754
formData.append('database', database);
48-
formData.append('id', crashId.toString());
55+
formData.append('id', crashIds.join(','));
4956
formData.append('force', force.toString());
5057
if (processor) {
5158
formData.append('processor', processor);

0 commit comments

Comments
 (0)