Skip to content

Commit

Permalink
Merge pull request #2 from SSTIA/master
Browse files Browse the repository at this point in the history
merge upstream
  • Loading branch information
arsdragonfly authored Jan 24, 2018
2 parents f6468fc + bb8c1e3 commit ed7d219
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 56 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# GOMOKU BRAIN COMPETITION

[![Build Status](https://travis-ci.org/SSTIA/fun-portal.svg?branch=master)](https://travis-ci.org/SSTIA/fun-portal)
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
[![GPL Licence](https://badges.frapsoft.com/os/gpl/gpl.svg?v=103)](https://opensource.org/licenses/GPL-3.0/)
[![David](https://david-dm.org/SSTIA/fun-portal.svg)](https://david-dm.org/SSTIA/fun-portal)

## Introduction

Expand Down
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,70 @@
},
"dependencies": {
"aigle": "^1.10.1",
"app-module-path": "^2.0.0",
"babel-runtime": "^6.11.6",
"app-module-path": "^2.2.0",
"babel-runtime": "^6.26.0",
"basic-auth": "^2.0.0",
"bcrypt-as-promised": "^1.1.0",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"bluebird": "^3.5.1",
"body-parser": "^1.18.2",
"chalk": "^2.3.0",
"clipboard": "^1.5.15",
"compression": "^1.6.2",
"clipboard": "^1.7.1",
"compression": "^1.7.1",
"connect-mongo": "^2.0.1",
"cookie-parser": "^1.4.3",
"csurf": "^1.9.0",
"dg-error-factory": "^1.0.2",
"dg-framework": "^2.0.2",
"diff-dom": "^2.1.0",
"diff-dom": "^2.3.1",
"elo-rank": "^1.0.3",
"eventemitter2": "^5.0.1",
"express": "^4.14.0",
"express": "^4.16.2",
"express-decorators": "^0.5.0",
"express-session": "^1.14.1",
"filesize": "^3.3.0",
"express-session": "^1.15.6",
"filesize": "^3.5.11",
"flex-layout-attribute": "^1.0.3",
"fs-promise": "^2.0.3",
"gridfs-stream": "^1.1.1",
"helmet": "^3.9.0",
"jquery": "^3.1.1",
"jquery": "^3.3.1",
"jquery-scroll-lock": "^3.1.3",
"jquery.easing": "^1.4.1",
"jquery.transit": "^0.9.12",
"lodash": "^4.16.2",
"method-override": "^2.3.6",
"moment": "^2.15.1",
"mongoose": "^4.13.9",
"morgan": "^1.7.0",
"multer": "^1.2.0",
"lodash": "^4.17.4",
"method-override": "^2.3.10",
"moment": "^2.20.1",
"mongoose": "^5.0.1",
"morgan": "^1.9.0",
"multer": "^1.3.0",
"normalize.css": "^7.0.0",
"nunjucks": "^3.0.1",
"oauth": "^0.9.14",
"oauth": "^0.9.15",
"oauth-jaccount": "^0.0.1",
"open-color": "^1.3.2",
"open-color": "^1.6.2",
"prism-themes": "^1.0.0",
"prismjs": "^1.5.1",
"queue": "^4.0.0",
"prismjs": "^1.10.0",
"queue": "^4.4.2",
"rascal": "breeswish/rascal#promisify-friendly",
"redis": "^2.6.3",
"request": "^2.75.0",
"request-promise-native": "^1.0.3",
"redis": "^2.8.0",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"rupture": "^0.7.1",
"slideout": "^1.0.1",
"socket.io": "^2.0.4",
"socket.io-client": "^2.0.4",
"source-map-support": "^0.5.0",
"source-map-support": "^0.5.2",
"sticky-kit": "^1.1.3",
"tether": "^1.3.7",
"tether": "^1.4.3",
"tether-drop": "^1.4.2",
"timeago.js": "^3.0.2",
"uuid": "^3.1.0",
"uuid": "^3.2.1",
"validator": "^9.2.0",
"winston": "^2.2.0",
"winston": "^2.4.0",
"yargs": "^10.1.1"
},
"devDependencies": {
"autoprefixer": "^7.2.4",
"babel-core": "^6.16.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-loader": "^7.1.2",
"babel-plugin-lodash": "^3.3.2",
Expand All @@ -91,9 +91,9 @@
"babel-preset-env": "^1.6.1",
"babel-preset-stage-0": "^6.24.1",
"copy-webpack-plugin": "^4.3.1",
"css-loader": "^0.28.8",
"css-loader": "^0.28.9",
"del": "^3.0.0",
"eslint": "^4.15.0",
"eslint": "^4.16.0",
"eslint-loader": "^1.5.0",
"eslint-plugin-babel": "^4.1.2",
"extract-text-webpack-plugin": "^3.0.2",
Expand All @@ -104,13 +104,13 @@
"gulp-babel": "^7.0.0",
"gulp-eslint": "^4.0.1",
"gulp-file-cache": "0.0.1",
"gulp-iconfont": "^9.0.2",
"gulp-iconfont": "^9.1.0",
"gulp-nodemon": "^2.2.1",
"gulp-nunjucks": "^3.1.1",
"gulp-plumber": "^1.2.0",
"gulp-sourcemaps": "^2.6.3",
"gulp-svgmin": "^1.2.3",
"happypack": "^4.0.0",
"happypack": "^4.0.1",
"postcss-loader": "^2.0.10",
"style-loader": "^0.19.1",
"stylus": "^0.54.5",
Expand Down
15 changes: 15 additions & 0 deletions src/models/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ export default () => {
}).exec();
};

SubmissionSchema.methods.resetExceptionAsync = async function() {


if (this.status === Submission.STATUS_RUNNING) {
// reset state to effective
this.status = Submission.STATUS_EFFECTIVE;
await this.save();
} else if (this.status === Submission.STATUS_PENDING ||
this.status === Submission.STATUS_COMPILING) {
// resend compile request
this.taskToken = null;
await Submission.createCompileTaskAsync(this);
}
};

/**
* Check whether a user is allowed to submit new code
*
Expand Down
23 changes: 0 additions & 23 deletions src/services/init.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/services/system.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import _ from 'lodash';

export default async () => {

const system = {
initialized: false,
init: async () => {
system.initialized = false;
await DI.model.sys.setAsync('readonly', true);

const sdocs = await DI.models.getExceptionSubmissionAsync();
_.forEach(sdocs, sdoc => {

});

system.initialized = true;
await DI.model.sys.setAsync('readonly', false);
},
};

let readyExit = false;
process.on('SIGINT', async () => {
DI.logger.info('Server received SIGINT, exiting');
if (!readyExit) {
readyExit = true;
await DI.model.sys.setAsync('readonly', true);
setInterval(async () => {
// waiting for all process ending
process.exit(0);
}, 1000);
}
});

return system;
};

1 change: 1 addition & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ module.exports = {
},
},
],
threads: 4,
}),

new webpack.ProvidePlugin({
Expand Down

0 comments on commit ed7d219

Please sign in to comment.