-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug whereby too many node connections are created under high lo…
…ad leading to 429s (#522) * Fix a bug whereby too many node connections are created under high load leading to 429s Adds a test for creating 500 demandAs in parrallel and then fixs exposed issues. Broadly speaking this is caused by each controller being instantiated for each request. This was then making a ChainNode per request and thus a polkadot instance. I've made `ChainNode` a singleton now to avoid this. In order to make tests perform sensibly I've also improved the way we were polling for state changes * Add reflect-metadata' * Fix container reset in test * Updating version to 3.1.0 * Fix linting issues * Fix tests import reflect-metadata' --------- Co-authored-by: dc-autobot[bot] <181364585+dc-autobot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9ccde68
commit b32e52f
Showing
26 changed files
with
259 additions
and
132 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import { IocContainer } from '@tsoa/runtime' | ||
import { container } from 'tsyringe' | ||
import { Logger } from 'pino' | ||
|
||
import env, { type Env, EnvToken } from './env.js' | ||
import { logger, LoggerToken } from './lib/logger.js' | ||
|
||
export const iocContainer: IocContainer = { | ||
get: <T>(controller: { prototype: T }): T => { | ||
return container.resolve<T>(controller as never) | ||
}, | ||
} | ||
|
||
export function resetContainer() { | ||
container.reset() | ||
container.register<Env>(EnvToken, { useValue: env }) | ||
container.register<Logger>(LoggerToken, { useValue: logger }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.