Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Oct 4, 2024
1 parent 4478966 commit 9fb506d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion backend/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ if (!PARENTNET_WALLET || !CHECKPOINT_CONTRACT) {

export const { NODE_ENV, LOG_FORMAT, STATS_SECRET } = process.env;

export const CORS_ALLOW_ORIGIN = process.env.CORS_ALLOW_ORIGIN || '';
export const CORS_ALLOW_ORIGIN = process.env.CORS_ALLOW_ORIGIN || '';

export const STATS_PORT = process.env.STATS_PORT || '5213';
5 changes: 3 additions & 2 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import http from 'http';
import { STATS_PORT } from './config';
import { App } from './app';
import { Route } from './routes';
import { EventsHandler } from './events';
Expand All @@ -9,9 +10,9 @@ const app = new App([new Route()]);
const server = http.createServer(app.getServer());
const eventHandler = new EventsHandler(server);

server.listen(5213, () => {
server.listen(STATS_PORT, () => {
eventHandler.init();
logger.info(`=================================`);
logger.info('🚀 Subnet Stats Service listening on the port 5213');
logger.info(`🚀 Subnet Stats Service listening on the port ${STATS_PORT}`);
logger.info(`=================================`);
});
9 changes: 5 additions & 4 deletions backend/src/services/block.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,11 @@ export class BlockService {

let isProcessing = true;
const blockDiff = subnetCommittedNumber - smartContractHeight;
if (mode == 'lite') {
if (blockDiff > 1000) isProcessing = false;
} else if (mode == 'full') {
if (blockDiff > 100) isProcessing = false;
if (mode == 'lite' && blockDiff > 1000) {
isProcessing = false;
}
if (mode == 'full' && blockDiff > 100) {
isProcessing = false;
}

return {
Expand Down

0 comments on commit 9fb506d

Please sign in to comment.