Skip to content

Commit

Permalink
fix: clister config
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Sep 10, 2023
1 parent 2dedd0d commit 51c9616
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
10 changes: 5 additions & 5 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ export class Cluster {
const cpuCount = this.getCpuCount();

if (cluster.isPrimary) {
this.loggerService.log(`Starting cluster with ${cpuCount} workers...`);
this.loggerService.log(`Master server is running on process ${process.pid}`);
this.loggerService.log(`📑 Starting cluster with ${cpuCount} workers...`);
this.loggerService.log(`📑 Master server is running on process ${process.pid}`);

for (let index = 0; index < cpuCount; index++) {
this.loggerService.log(`Forking process number ${index + 1}...`);
this.loggerService.log(`📑 Forking process number ${index + 1}...`);
cluster.fork();
}

cluster.on("exit", (worker) => {
this.loggerService.warn(`Worker ${worker.id} died. `);
this.loggerService.warn("Starting a new worker...");
this.loggerService.warn(`🚦 Worker ${worker.id} died. `);
this.loggerService.warn("🚦 Starting a new worker...");
cluster.fork();
});
}
Expand Down
24 changes: 12 additions & 12 deletions src/modules/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export class AuthController {
@Post("login/magic")
@ApiOperation({ summary: "User Login with magic link" })
loginByMagicLink(
@Req() request: Request,
@Res() response: Response,
@Body() dto: MagicLinkLogin,
@Req() request: Request,
@Res() response: Response,
@Body() dto: MagicLinkLogin,
): Observable<void> {
return this.authService.validateUser(false, dto.destination).pipe(
map((_user) => {
Expand Down Expand Up @@ -103,9 +103,9 @@ export class AuthController {
@Get("google/callback")
@UseGuards(AuthGuard("google"))
googleAuthRedirect(
@LoggedInUser()
user: OauthResponse,
@Res() response: Response,
@LoggedInUser()
user: OauthResponse,
@Res() response: Response,
) {
return this.authService.login({ email: user.email }, false).pipe(
map((data) => {
Expand All @@ -126,9 +126,9 @@ user: OauthResponse,
@Get("facebook/callback")
@UseGuards(AuthGuard("facebook"))
facebookAuthRedirect(
@LoggedInUser()
user: OauthResponse,
@Res() response: Response,
@LoggedInUser()
user: OauthResponse,
@Res() response: Response,
) {
return this.authService.login({ email: user.email }, false).pipe(
map((data) => {
Expand Down Expand Up @@ -178,9 +178,9 @@ user: OauthResponse,
@ApiOperation({ summary: "Logout user" })
@Post("logout")
logout(
@LoggedInUser() user: User,
@Query("from_all", new DefaultValuePipe(false), ParseBoolPipe) fromAll: boolean,
@Body() refreshToken?: RefreshTokenDto,
@LoggedInUser() user: User,
@Query("from_all", new DefaultValuePipe(false), ParseBoolPipe) fromAll: boolean,
@Body() refreshToken?: RefreshTokenDto,
): Observable<User> {
return fromAll
? this.authService.logoutFromAll(user)
Expand Down
16 changes: 8 additions & 8 deletions src/modules/health/health.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ export class HealthController {
() =>
this.http.pingCheck(
"swagger",
`${this.configService.get("app.url", {
infer: true,
})}:${this.configService.get("app.port", { infer: true })}/doc`,
`${this.configService.get("app.url", {
infer: true,
})}:${this.configService.get("app.port", { infer: true })}/doc`,
),
() =>
this.http.pingCheck(
"routes",
`${this.configService.get("app.url", {
infer: true,
})}:${this.configService.get("app.port", {
infer: true,
})}/${this.configService.get("app.prefix", { infer: true })}/health/test`,
`${this.configService.get("app.url", {
infer: true,
})}:${this.configService.get("app.port", {
infer: true,
})}/${this.configService.get("app.prefix", { infer: true })}/health/test`,
),
async () => this.databaseHealth.pingCheck("mikroOrm"),
async () => this.memory.checkHeap("memory_heap", 200 * 1024 * 1024),
Expand Down
8 changes: 4 additions & 4 deletions src/modules/profile/profile.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class ProfileController {
params: ["username"],
})
follow(
@LoggedInUser() user: User,
@Param("username") username: string,
@LoggedInUser() user: User,
@Param("username") username: string,
): Observable<ProfileData> {
return this.profileService.follow(user, username);
}
Expand All @@ -44,8 +44,8 @@ export class ProfileController {
params: ["username"],
})
unFollow(
@LoggedInUser() user: User,
@Param("username") username: string,
@LoggedInUser() user: User,
@Param("username") username: string,
): Observable<ProfileData> {
return this.profileService.unFollow(user, username);
}
Expand Down
8 changes: 4 additions & 4 deletions src/modules/twofa/twofa.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class TwoFactorController {
@Post("authenticate")
@UseGuards(AuthGuard("jwt2fa"))
authenticate(
@LoggedInUser() user: User,
@Body() twoFaAuthDto: TwofaDto,
@LoggedInUser() user: User,
@Body() twoFaAuthDto: TwofaDto,
): Observable<AuthenticationResponse> {
const isCodeValid = this.twoFactorAuthenticationService.isTwoFactorCodeValid(
twoFaAuthDto.code,
Expand All @@ -49,8 +49,8 @@ export class TwoFactorController {
@Auth()
@Post("turn-on")
turnOnTwoFactorAuthentication(
@LoggedInUser() user: User,
@Body() dto: TwofaDto,
@LoggedInUser() user: User,
@Body() dto: TwofaDto,
): Observable<User> {
return this.twoFactorAuthenticationService.turnOnTwoFactorAuthentication(dto.code, user);
}
Expand Down
18 changes: 9 additions & 9 deletions src/modules/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export class UserController {
})
@ApiFile({ fieldName: "avatar", required: true }) // fix this
publicRegistration(
@Body() dto: UserRegistrationDto,
@UploadedFile(fileValidatorPipe({}))
image: File,
@Body() dto: UserRegistrationDto,
@UploadedFile(fileValidatorPipe({}))
image: File,
): Observable<User> {
return this.userService.create({
...dto,
Expand Down Expand Up @@ -66,9 +66,9 @@ image: File,
@CheckPolicies(new GenericPolicyHandler(User, Action.Create))
@ApiFile({ fieldName: "avatar", required: true })
create(
@Body() dto: CreateUserDto,
@UploadedFile(fileValidatorPipe({}))
image: File,
@Body() dto: CreateUserDto,
@UploadedFile(fileValidatorPipe({}))
image: File,
): Observable<User> {
return this.userService.create({ ...dto, files: image });
}
Expand All @@ -82,9 +82,9 @@ image: File,
})
@CheckPolicies(new GenericPolicyHandler(User, Action.Update))
update(
@UUIDParam("idx") index: string,
@Body() dto: EditUserDto,
@UploadedFile(fileValidatorPipe({ required: false })) image?: File,
@UUIDParam("idx") index: string,
@Body() dto: EditUserDto,
@UploadedFile(fileValidatorPipe({ required: false })) image?: File,
): Observable<User> {
return this.userService.update(index, dto, image);
}
Expand Down

0 comments on commit 51c9616

Please sign in to comment.