Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ const errorHandler = (
});
}

services.initApi();
logger.warn('📡 [global]: Connection reinitialized.');
// services.initApi();
// logger.warn('📡 [global]: Connection reinitialized.');
logger.warn('📡 [global]: Apps go to reload.');
process.exit(1);
};

const loggingResponse = (_: Request, res: Response, next: NextFunction) => {
Expand Down Expand Up @@ -65,15 +67,15 @@ app.post('/api/v1/swork/workreport', services.swork.reportWorks);
app.use(errorHandler);
process.on('uncaughtException', (err: Error) => {
logger.error(`☄️ [global] Uncaught exception ${err.message}`);
if (++errorHandlingCount <= maxErrorHandlingCount) {
errorHandler(err, null, null, null);
} else {
logger.error(
'Reach max error handling count, just exit and waitinng for restart'
);
// eslint-disable-next-line no-process-exit
process.exit(1);
}
// if (++errorHandlingCount <= maxErrorHandlingCount) {
// errorHandler(err, null, null, null);
// } else {
// logger.error(
// 'Reach max error handling count, just exit and waitinng for restart'
// );
// }
// eslint-disable-next-line no-process-exit
process.exit(1);
});

app.listen(PORT, () => {
Expand Down
4 changes: 2 additions & 2 deletions src/services/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export async function sendTx(tx: SubmittableExtrinsic, krp: KeyringPair) {
` ↪ 💸 [tx]: Transaction status: ${status.type}, nonce: ${tx.nonce}`
);

if (status.isInvalid || status.isDropped || status.isUsurped) {
if (status.isInvalid || status.isDropped || status.isUsurped || status.isRetracted) {
reject(new Error(`${status.type} transaction.`));
} else {
// Pass it
}

if (status.isInBlock) {
if (status.isFinalized) {
events.forEach(({event: {data, method, section}}) => {
if (section === 'system' && method === 'ExtrinsicFailed') {
const [dispatchError] = data as unknown as ITuple<[DispatchError]>;
Expand Down