Skip to content

Commit 24f6a84

Browse files
authored
fix(update): when saving a job via _id add job name
this allows using sharded collections for improved performance, as this is the only place where job name is not provided. sharding by name: db.runCommand( { shardCollection: "YOUR-COLLECTION.agendaJobs", key: { name: 1 } } )
1 parent c4852db commit 24f6a84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/agenda/save-job.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = async function(job) {
7474
// Update the job and process the resulting data'
7575
debug('job already has _id, calling findOneAndUpdate() using _id as query');
7676
const result = await this._collection.findOneAndUpdate(
77-
{_id: id},
77+
{_id: id, name: props.name},
7878
update,
7979
{returnOriginal: false}
8080
);

0 commit comments

Comments
 (0)