Browse Source

fixe reawake function

unknown 2 years ago
parent
commit
04184aed85
1 changed files with 11 additions and 2 deletions
  1. 11 2
      bin/server.js

+ 11 - 2
bin/server.js

@@ -2,10 +2,19 @@ const app = require('../app');
 const db = require('../model/db');
 const createFolderIsExist = require('../helpers/create-directory');
 const PORT = process.env.PORT || 3000;
-const BASE_URL = process.env.BASE_URL;
+const APP_NAME = process.env.APP_NAME;
+const http = require('http');
 
 setInterval(() => {
-	http.get(`${BASE_URL}`);
+	http
+		.get(`http://${APP_NAME}.herokuapp.com`, function (res) {
+			res.on('data', function (_chunk) {
+				console.log('HEROKU RESPONSE: PINGED EVERY 25 MINUTES');
+			});
+		})
+		.on('error', function (_err) {
+			console.log('HEROKU RESPONSE: NOT PINGED');
+		});
 }, 25 * 60 * 1000);
 
 db.then(() => {