diff --git a/apps/api/src/app/groups/groups.service.test.ts b/apps/api/src/app/groups/groups.service.test.ts index 3dbb4e76..812097ff 100644 --- a/apps/api/src/app/groups/groups.service.test.ts +++ b/apps/api/src/app/groups/groups.service.test.ts @@ -44,8 +44,6 @@ describe("GroupsService", () => { }).compile() groupsService = await module.resolve(GroupsService) - await groupsService.initialize() - invitesService = await module.resolve(InvitesService) const { id } = await groupsService.createGroup( @@ -725,17 +723,4 @@ describe("GroupsService", () => { await expect(fun).rejects.toThrow("You are not the admin") }) }) - - describe("# initialize", () => { - it("Should initialize the cached groups", async () => { - const currentCachedGroups = await groupsService.getGroups() - - await groupsService.initialize() - - const updatedCachedGroups = await groupsService.getGroups() - - expect(currentCachedGroups).toHaveLength(updatedCachedGroups.length) - expect(currentCachedGroups).toStrictEqual(updatedCachedGroups) - }) - }) }) diff --git a/apps/api/src/app/groups/groups.service.ts b/apps/api/src/app/groups/groups.service.ts index edf03ccf..42836a9c 100644 --- a/apps/api/src/app/groups/groups.service.ts +++ b/apps/api/src/app/groups/groups.service.ts @@ -39,19 +39,13 @@ export class GroupsService { process.env.BACKEND_PRIVATE_KEY as string, process.env.INFURA_API_KEY as string ) - } - /** - * Initialises the service, caches groups and may sync contract - * groups if required. - */ - async initialize() { - await this._cacheGroups() + this._cacheGroups() /* istanbul ignore next */ if (process.env.NODE_ENV !== "test") { - setTimeout(async () => { - await this._syncContractGroups() + setTimeout(() => { + this._syncContractGroups() }, 5000) } } diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index cbd02fe5..ea97a6c8 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -3,14 +3,10 @@ import { NestFactory } from "@nestjs/core" import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger" import { ironSession } from "iron-session/express" import { AppModule } from "./app/app.module" -import { GroupsService } from "./app/groups/groups.service" async function bootstrap() { const app = await NestFactory.create(AppModule) - const groupService = app.get(GroupsService) - await groupService.initialize() - app.useGlobalPipes( new ValidationPipe({ whitelist: true,