Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# v2.8.0

Reaction v2.8.0 adds performance enhancements and fixes bugs.

This release is being coordinated with [Reaction Platform](https://github.com/reactioncommerce/reaction-platform) and is designed to work with `v2.8.0` of [Reaction Hydra](https://github.com/reactioncommerce/reaction-hydra) and [Example Storefront](https://github.com/reactioncommerce/example-storefront).

## Notable changes

### Fix memory issues in jest tests

Jest integration tests were failing due to a memory leak in async test code. We have closed that memory leak with this release.

## Fixes

Merge pull request #5733 from reactioncommerce/fix-aldeed-memory-issues

- fix: fix memory issues with jest tests ([#5733](https://github.com/reactioncommerce/reaction/pull/5733))

# v2.7.0

Reaction v2.7.0 adds performance enhancements and fixes bugs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ export default function createJobClass() {
let cb = rest[adjustedLength - 1];

[options, cb] = Array.from(optionsHelp(options, cb));
if (typeof options.timeout !== "number") { options.timeout = 60 * 1000; }
return methodCall(root, "shutdownJobServer", [options], cb);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,42 +463,38 @@ export default function createJobCollectionClass({ Job, later }) {

// eslint-disable-next-line camelcase
_DDPMethod_startJobServer() {
// The client can't actually do this, so skip it
if (!this.isSimulation) {
if (this.stopped && (this.stopped !== true)) { clearTimeout(this.stopped); }
this.stopped = false;
}
this.stopped = false;
return true;
}

// eslint-disable-next-line camelcase
_DDPMethod_shutdownJobServer(options = {}) {
if (!options.timeout) {
options.timeout = 60 * 1000;
}
async _DDPMethod_shutdownJobServer() {
this.stopped = true;

// The client can"t actually do any of this, so skip it
if (!this.isSimulation) {
if (this.stopped && (this.stopped !== true)) { clearTimeout(this.stopped); }
this.stopped = setTimeout(
async () => {
const cursor = this.collection.find({ status: "running" });
const failedJobs = await cursor.count();
// Fail all currently running jobs
if (this.collection) {
const runningJobs = await this.collection.find({
status: "running"
}, {
projection: {
_id: 1,
runId: 1
}
}).toArray();

if (failedJobs !== 0) {
console.warn(`Failing ${failedJobs} jobs on queue stop.`);
}
if (runningJobs.length > 0) {
console.warn(`Failing ${runningJobs.length} jobs on queue stop.`);

await Promise.all(cursor.map((doc) => this._DDPMethod_jobFail(doc._id, doc.runId, "Running at Job Server shutdown.")));
await Promise.all(runningJobs.map((doc) => this._DDPMethod_jobFail(doc._id, doc.runId, "Running at Job Server shutdown.")));
}
}

if (this.logStream !== null) { // Shutting down closes the logStream!
this.logStream.end();
this.logStream = null;
}
},
options.timeout
);
// Close the log stream
if (this.logStream !== null) {
this.logStream.end();
this.logStream = null;
}

return true;
}

Expand Down
4 changes: 4 additions & 0 deletions imports/test-utils/setupJestIntegrationTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
process.on("unhandledRejection", (err) => {
console.error("unhandledRejection:", err); // eslint-disable-line no-console
process.exit(10); // eslint-disable-line no-process-exit
});
3 changes: 2 additions & 1 deletion jest-mongodb-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
version: "3.6.14",
skipMD5: true
},
autoStart: false
autoStart: false,
debug: true
}
};
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const jestConfig = {
// integration tests as opposed to unit tests, which don't need MongoDB running.
if (process.env.JEST_MONGO) {
delete jestConfig.testEnvironment;
jestConfig.setupFilesAfterEnv = ["<rootDir>/imports/test-utils/setupJestIntegrationTests.js"];
jestConfig.preset = "@shelf/jest-mongodb";
}

Expand Down
Loading