Skip to content

Commit b3cf764

Browse files
add jobLogs to error handler
1 parent 78953af commit b3cf764

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bull/pdl-queue/consumer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,19 @@ async function uploadToIA(zip, metadata, byteLength, email, job) {
117117
}
118118

119119
PDLQueue.process(async (job, done) => {
120+
const jobLogs = job.data.details;
121+
const trueURI = `http://archive.org/details/${job.data.details.IAIdentifier}`;
122+
jobLogs["trueURI"] = trueURI;
123+
jobLogs["userName"] = job.data.details.userName;
120124
const [zip, byteLength, isError] = await getZipAndBytelength(
121125
job.data.details.Pages,
122126
job.data.details.bookID,
123127
job.data.details.title,
124128
job
125129
);
126-
127130
if (isError) {
131+
job.log(JSON.stringify(jobLogs));
132+
logUserData(jobLogs["userName"], "Panjab Digital Library");
128133
logger.log({
129134
level: "error",
130135
message: `PDL Failure PDL Server failed to return images`,
@@ -133,10 +138,6 @@ PDLQueue.process(async (job, done) => {
133138
job.progress(100);
134139
done(null, false);
135140
} else {
136-
const jobLogs = job.data.details;
137-
const trueURI = `http://archive.org/details/${job.data.details.IAIdentifier}`;
138-
jobLogs["trueURI"] = trueURI;
139-
jobLogs["userName"] = job.data.details.userName;
140141
job.log(JSON.stringify(jobLogs));
141142
logUserData(jobLogs["userName"], "Panjab Digital Library");
142143
job.progress(90);

0 commit comments

Comments
 (0)