Skip to content

Commit

Permalink
fix: tweaks from testing
Browse files Browse the repository at this point in the history
Signed-off-by: Brent Hoover <[email protected]>
  • Loading branch information
Brent Hoover authored and vanpho93 committed May 19, 2023
1 parent ee4d9e7 commit d000ff9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/api-plugin-bull-queue/src/api/createQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default function createQueue(context, queueName, options = defaultOptions
});

newQueue.on("failed", (job, err) => {
Logger.error({ ...err, ...logCtx }, "Job process failed");
const error = JSON.stringify(err);
Logger.error({ error, ...logCtx }, "Job process failed");
});
return newQueue;
}
2 changes: 1 addition & 1 deletion packages/api-plugin-bull-queue/src/api/scheduleJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const logCtx = {
* @return {Boolean} - true if success
*/
export default async function scheduleJob(context, queueName, jobName, jobData, schedule) {
if (typeof jobData !== "object" || typeof schedule !== "string") {
if (typeof jobData !== "object" || typeof schedule !== "string" || typeof queueName !== "string" || typeof jobName !== "string") {
Logger.error(logCtx, "Invalid parameters supplied to scheduleJob");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ async function markActive(context) {
]
}).toArray();
for (const promotion of toMarkActive) {
const { modifiedCount } = Promotions.updateOne({ _id: promotion._id }, { $set: { state: "active" } });
// eslint-disable-next-line no-await-in-loop
const { modifiedCount } = await Promotions.updateOne({ _id: promotion._id }, { $set: { state: "active" } });
if (modifiedCount === 1) {
appEvents.emit("promotionActivated", promotion);
Logger.info({ promotionId: promotion._id, ...logCtx }, "Promotion made active");
totalUpdated += 1;
} else {
Logger.error({ promotionId: promotion._id, ...logCtx }, "Error updating promotion record to active");
Expand Down

0 comments on commit d000ff9

Please sign in to comment.