Skip to content

Commit

Permalink
Merge pull request #122 from Cerebellum-Network/release/0.25.0
Browse files Browse the repository at this point in the history
Release v0.25.0
  • Loading branch information
DmitriyMolch authored Jan 25, 2023
2 parents 86f7ed6 + 7903e91 commit e03c7b5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## vNext
- ...

## v0.25.0
- [BE] Fix crawlers status restore after fail

## v0.24.3
- [BE] Add missing `next` functions to prevent Stats API crash

Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.24.3",
"version": "0.25.0",
"description": "PolkaStats API",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions backend/backend.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
port: parseInt(process.env.POSTGRES_PORT, 10) || 5432,
},
logLevel: process.env.LOG_LEVEL || 'info', // Use 'debug' to see DEBUG level messages
spawnTimeoutMs: parseInt(process.env.SPAWN_TIMEOUT_MS, 10) || 5000,
crawlers: [
{
name: 'blockListener',
Expand Down
7 changes: 6 additions & 1 deletion backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { spawn } = require('child_process');
const { StatusCodes } = require('http-status-codes');
const { wait, getEnabledCrawlerNames, getEnabledCrawlers } = require('./lib/utils');
const config = require('./backend.config');
const Status = require('./lib/status');
const { Status, statuses: appStatuses } = require('./lib/status');

const app = express();
const logger = pino();
Expand All @@ -27,6 +27,7 @@ const runCrawler = async ({ crawler, name }) => {
child.on('exit', (exitCode, signal) => {
logger.warn(`Crawler ${crawler} exit with code: ${exitCode} and signal: ${signal}`);
status.set(name, `exit code ${exitCode}, signal ${signal}`);
setTimeout(() => runCrawler({ crawler, name }), config.spawnTimeoutMs);
});
child.on('uncaughtException', (error) => {
logger.warn(`Crawler ${crawler} exit with uncaughtException: ${error}`);
Expand All @@ -40,6 +41,10 @@ const runCrawler = async ({ crawler, name }) => {
logger.warn(`Crawler ${crawler} exit SIGUSR2`);
status.set(name, 'exit SIGUSR2');
});
child.on('spawn', () => {
logger.info('Process spawned');
status.set(name, appStatuses.HEALTHY);
});
};

const runCrawlers = async () => {
Expand Down
5 changes: 4 additions & 1 deletion backend/lib/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ class Status {
}
}

module.exports = Status;
module.exports = {
statuses,
Status,
};
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "0.24.3",
"version": "0.25.0",
"description": "PolkaStats NG Backend",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "0.24.3",
"version": "0.25.0",
"description": "PolkaStats NG frontend",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "cerestats",
"version": "0.24.3",
"version": "0.25.0",
"description": "Cere Stats mono repo",
"repository": {
"type": "git",
Expand Down

0 comments on commit e03c7b5

Please sign in to comment.