Skip to content

Commit

Permalink
Merge pull request #5137 from reactioncommerce/perf-aldeed-add-jobs-i…
Browse files Browse the repository at this point in the history
…ndex

perf: create index for Jobs queries
  • Loading branch information
aldeed authored Apr 19, 2019
2 parents 0e22b22 + 8fdf9e7 commit dd49201
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imports/utils/jobs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { check, Match } from "meteor/check";
import { Meteor } from "meteor/meteor";
import { Mongo } from "meteor/mongo";
import { Mongo, MongoInternals } from "meteor/mongo";
import createJobCollection from "@reactioncommerce/job-queue";
import collectionIndex from "./collectionIndex";

const later = Meteor.isServer && require("later");

Expand All @@ -11,4 +12,8 @@ const Jobs = new JobCollection("Jobs", {
noCollectionSuffix: true
});

// Add an index to support the `status: "running"` lookups it does
const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo;
collectionIndex(db.collection("Jobs"), { status: 1 });

export { Jobs, Job };

0 comments on commit dd49201

Please sign in to comment.