Commit 9e2481e9 authored by therealwolf's avatar therealwolf 💯
Browse files

increase memory

parent a271fe6c
......@@ -4,9 +4,9 @@
"description": "",
"main": "dist/server.js",
"scripts": {
"start": "cross-env NODE_ENV=production ts-node src/server.ts",
"staging": "cross-env NODE_ENV=staging ts-node src/server.ts",
"dev": "cross-env NODE_ENV=development ts-node-dev src/server.ts"
"start": "NODE_ENV=production node --max-old-space-size=8888 -- node_modules/.bin/ts-node -P tsconfig.json src/server.ts",
"staging": "NODE_ENV=staging node --max-old-space-size=8888 -- node_modules/.bin/ts-node -P tsconfig.json src/server.ts",
"dev": "NODE_ENV=development node --max-old-space-size=8888 -- node_modules/.bin/ts-node-dev -P tsconfig.json src/server.ts"
},
"author": "therealwolf42",
"license": "MIT",
......
......@@ -47,7 +47,7 @@ export let start = async () => {
_g.pool = await new _g.sql.ConnectionPool(connection_config).connect();
_g.global_data = await db_global.find();
if (process.env.NODE_ENV === "production") await clean_old_data_entries();
// if (process.env.NODE_ENV === "production") await clean_old_data_entries();
main();
} catch (e) {
console.error("Main Error", e);
......
......@@ -28,17 +28,18 @@ export let update_data = async () => {
// Update CUSTOM JSON DAU for 'vote', 'transfer' & 'delegate'
const d = moment.utc().subtract(62, "d").toISOString();
let x = await Promise.all([
dau_general("vote", d),
dau_general("transfer", d),
dau_general("delegate", d),
dau_general("active_user", d),
]);
// let x = await Promise.all([
// dau_general("vote", d),
// dau_general("transfer", d),
// dau_general("delegate", d),
// dau_general("active_user", d),
// ]);
// dau_general('follow', d) # for the future
let apps = await db_app.find_approved(true);
for (let app of apps) {
if (app.name !== "inji") continue;
try {
if (
moment.utc().dayOfYear() <=
......@@ -141,6 +142,7 @@ export let set_data = async () => {
await update_global_properties();
let apps = await db_app.find_approved(true);
for (let app of apps) {
if (app.name !== "inji") continue;
try {
console.log("Setting data", app.name);
let volume_hbd_container = [];
......
import * as dotenv from 'dotenv'; dotenv.config({ path: '.env' });
import * as express from 'express'
import * as bodyParser from 'body-parser'
import * as cors from 'cors'
import * as celebrate from 'celebrate'
import * as helmet from 'helmet'
import * as rateLimit from 'express-rate-limit'
import * as main from './index'
import route_apps from './routes/app.route'
import route_data from './routes/data.route'
import route_categories from './routes/categories.route'
import route_app_types from './routes/app_types.route'
import route_data_types from './routes/data_types.route'
import route_global from './routes/global.route'
const app = express()
let port = process.env.port || 5000
app.set('port', port)
app.use(helmet())
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
app.use(cors())
import * as dotenv from "dotenv";
dotenv.config({ path: ".env" });
import * as express from "express";
import * as bodyParser from "body-parser";
import * as cors from "cors";
import * as celebrate from "celebrate";
import * as helmet from "helmet";
import * as rateLimit from "express-rate-limit";
import * as main from "./index";
import route_apps from "./routes/app.route";
import route_data from "./routes/data.route";
import route_categories from "./routes/categories.route";
import route_app_types from "./routes/app_types.route";
import route_data_types from "./routes/data_types.route";
import route_global from "./routes/global.route";
const app = express();
let port = process.env.port || 5002;
app.set("port", port);
app.use(helmet());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(cors());
// Enable later
//app.enable("trust proxy") // API Endpoint behind proxy
//const limiter = rateLimit({ windowMs: 10 * 60 * 1000, max: 1000 });
//app.use(limiter)
app.use('/api/apps', route_apps)
app.use('/api/global', route_global)
app.use('/api/data', route_data)
app.use('/api/categories', route_categories)
app.use('/api/app_types', route_app_types)
app.use('/api/data_types', route_data_types)
app.use(celebrate.errors())
app.listen(app.get('port'), async () => {
console.log("App is running at on port " + app.get('port') + " in " + app.get('env') + " mode")
main.start()
})
module.exports = app
app.use("/api/apps", route_apps);
app.use("/api/global", route_global);
app.use("/api/data", route_data);
app.use("/api/categories", route_categories);
app.use("/api/app_types", route_app_types);
app.use("/api/data_types", route_data_types);
app.use(celebrate.errors());
app.listen(app.get("port"), async () => {
console.log(
"App is running at on port " +
app.get("port") +
" in " +
app.get("env") +
" mode"
);
main.start();
});
module.exports = app;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment