Skip to content

Commit 91eb46e

Browse files
committed
Improved logging, fixed removal function payload, s3 api errors are
fatal
1 parent 169a9b1 commit 91eb46e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

services/queue/src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ let load = loader({
303303
publicBucket: publicArtifactBucket,
304304
privateBucket: privateArtifactBucket,
305305
monitor,
306-
ignoreError: true,
306+
ignoreError: false,
307307
expires: now,
308308
});
309309
debug('Expired %s artifacts', count);

services/queue/src/utils.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ const artifactUtils = {
8888
prefix: obj.Key,
8989
})));
9090

91+
// this will likely be a soft error, so we'll just log it
9192
const err = new Error('Failed to delete s3 objects');
9293
err.entries = errors;
9394
monitor.reportError(err);
9495
}
9596
} catch (err) {
97+
// and this is an api response error, most likely network issue or this needs to be retried
9698
monitor.debug('WARNING: Failed to delete expired artifacts: %s, %j', err, err);
9799
if (!ignoreError) {
98100
throw err;
@@ -109,7 +111,7 @@ const artifactUtils = {
109111

110112
// only s3 artifacts need to be deleted
111113
// 'object' artifacts are deleted at expiration by the object service
112-
114+
// if this fails, we stop and don't delete the db entry
113115
await Promise.all([
114116
deleteObjects(publicBucket, s3public),
115117
deleteObjects(privateBucket, s3private),
@@ -121,17 +123,18 @@ const artifactUtils = {
121123
});
122124

123125
try {
124-
monitor.debug({
125-
message: 'Deleting artifacts from db',
126-
count: entries.length,
127-
});
128-
129126
// delete all the artifacts from the db
130127
await db.fns.delete_queue_artifacts(
131-
JSON.stringify(entries.map(({ task_id, run_id, name }) => ({ task_id, run_id, name }))),
128+
JSON.stringify(entries.map(({ taskId: task_id, runId: run_id, name }) =>
129+
({ task_id, run_id, name }))),
132130
);
133131

134132
count += entries.length;
133+
monitor.debug({
134+
message: 'Deleted artifacts from db',
135+
batch: entries.length,
136+
total: count,
137+
});
135138
} catch (err) {
136139
monitor.debug('WARNING: Failed to delete expired artifacts: %s, %j', err, err);
137140
// Rethrow error, if we're not supposed to ignore it.

0 commit comments

Comments
 (0)