Skip to content

Commit

Permalink
add testTimeout endpoint, bump v1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjizhan committed Jun 22, 2023
1 parent f908d14 commit 6984b82
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acala-wormhole-relayer",
"version": "1.3.6",
"version": "1.3.7",
"description": "",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ export const TESTNET_MODE_WARNING = `
----------------------------
`;

export const VERSION = '1.3.6';
export const VERSION = '1.3.7';
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { relay, checkShouldRelay, getVersion } from './relay';
import { TESTNET_MODE_WARNING, VERSION } from './consts';
import router from './middlewares/router';
import { errorHandler } from './middlewares/error';
import { testTimeout } from './utils';

dotenv.config({ path: '.env' });
const PORT = process.env.PORT || 3111;
Expand All @@ -18,6 +19,7 @@ const startServer = async (): Promise<void> => {
app.use(bodyParser.json());

app.post('/relay', relay);
app.post('/testTimeout', testTimeout);
app.get('/shouldRelay', checkShouldRelay);
app.get('/version', getVersion);

Expand Down
9 changes: 9 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,12 @@ export const bridgeToken = async (
sequence,
};
};

export const testTimeout = async (request: any, response: any): Promise<void> => {
const timeout = request.body.timeout ?? 120000;
await new Promise(resolve => setTimeout(resolve, timeout));

return response.status(200).json({
msg: `${timeout} timeout ok`,
});
};

0 comments on commit 6984b82

Please sign in to comment.