Skip to content

Commit

Permalink
fix(stats): delete interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Dec 28, 2023
1 parent 1360288 commit 1ddea6d
Show file tree
Hide file tree
Showing 11 changed files with 788 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ fileignoreconfig:
- filename: packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts
checksum: b04680c071a8098191859f5a67124df3d168478ee2f997a361595b7244d1f5f7
- filename: yarn.lock
checksum: ea8fbd6222244fa124b28e9ebb6d4e3b59e5a32bc0a620ccb7ae8a5ed536a7a2
checksum: 7d003c01f8bee02f4f1910d80b12164c613b81c13db0b2e81e330d4413efaa6c
version: "1.0"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"@socialgouv/sre-secrets": "^1.14.5",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"lerna": "^8.0.0",
"lint-staged": "^15.0.0",
"lerna": "^8.0.1",
"lint-staged": "^15.2.0",
"node-talisman": "^1.29.10"
},
"workspaces": {
Expand Down
18 changes: 9 additions & 9 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"@opentelemetry/instrumentation-pg": "^0.37.0",
"@opentelemetry/sdk-node": "^0.46.0",
"@opentelemetry/semantic-conventions": "^1.18.1",
"@sentry/node": "^7.79.0",
"@sentry/opentelemetry-node": "^7.79.0",
"@sentry/node": "^7.91.0",
"@sentry/opentelemetry-node": "^7.91.0",
"@socialgouv/streaming-file-encryption": "^1.1.0",
"@types/source-map-support": "^0.5.4",
"axios": "^1.6.2",
Expand Down Expand Up @@ -131,19 +131,19 @@
"@types/pino": "^7.0.5",
"@types/pizzip": "^3.0.1",
"@types/rimraf": "^4.0.5",
"@types/sanitize-html": "^2.6.2",
"@types/supertest": "^6.0.0",
"@types/uuid": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@types/sanitize-html": "^2.9.5",
"@types/supertest": "^6.0.1",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.7.0",
"lint-staged": "^15.0.0",
"nodemon": "^3.0.0",
"lint-staged": "^15.2.0",
"nodemon": "^3.0.2",
"prettier": "^2.8.8",
"supertest": "^6.3.3",
"swagger-ui-express": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,9 @@ export class AdminStructuresService {
const usagersValidCountByStructure =
await this.getUsagersValideCountByStructure();

console.log({ usagersValidCountByStructure });

const usagersAllCountByStructure =
await this.getUsagersAllCountByStructure();

console.log({ usagersAllCountByStructure });
const usagersAyantsDroitsCountByStructure =
await this.getUsagersAyantsDroitsCountByStructure();

Expand Down
6 changes: 5 additions & 1 deletion packages/backend/src/stats/services/publicStats.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { StructuresService } from "../../structures/services";
import { FRANCE_REGION_CODES, FranceRegion, appLogger } from "../../util";
import { CronExpression, Cron } from "@nestjs/schedule";
import { isCronEnabled } from "../../config/services/isCronEnabled.service";
import { domifaConfig } from "../../config";

@Injectable()
export class PublicStatsService implements OnModuleInit {
Expand All @@ -22,7 +23,10 @@ export class PublicStatsService implements OnModuleInit {
) {}

onModuleInit() {
this.updateAllStatsCache();
// Inutile de rafraichir le cache sur le pod des tâches CRON
if (domifaConfig().envId !== "local" && !isCronEnabled()) {
this.updateAllStatsCache();
}
}

@Cron(CronExpression.EVERY_DAY_AT_3AM, {
Expand Down
11 changes: 2 additions & 9 deletions packages/backend/src/stats/stats.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { UsersModule } from "../users/users.module";
import { AdminStructuresModule } from "../_portail-admin/admin-structures/admin-structures.module";
import { StatsPrivateController } from "./controllers/stats.private.controller";
import { StatsPublicController } from "./controllers/stats.public.controller";
import { CacheInterceptor, CacheModule } from "@nestjs/cache-manager";
import { CacheModule } from "@nestjs/cache-manager";
import { PublicStatsService } from "./services/publicStats.service";
import { APP_INTERCEPTOR } from "@nestjs/core";

@Module({
controllers: [StatsPublicController, StatsPrivateController],
Expand All @@ -21,12 +20,6 @@ import { APP_INTERCEPTOR } from "@nestjs/core";
forwardRef(() => UsagersModule),
forwardRef(() => InteractionsModule),
],
providers: [
PublicStatsService,
{
provide: APP_INTERCEPTOR,
useClass: CacheInterceptor,
},
],
providers: [PublicStatsService],
})
export class StatsModule {}
6 changes: 3 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@eslint/create-config": "^0.4.6",
"@types/jest": "^29.5.8",
"@types/rimraf": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.53.0",
"eslint-config-standard-with-typescript": "^42.0.0",
"eslint-plugin-import": "^2.29.0",
Expand All @@ -33,7 +33,7 @@
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.7.0",
"license-check-and-add": "^4.0.5",
"lint-staged": "^15.0.0",
"lint-staged": "^15.2.0",
"prettier": "2.8.8",
"ts-jest": "^29.1.1",
"typescript": "^4.3.5"
Expand Down
20 changes: 10 additions & 10 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@khazii/ngx-intl-tel-input": "^3.2.0",
"@khazii/ngx-intl-tel-input": "^3.3.1",
"@ng-bootstrap/ng-bootstrap": "^15.1.2",
"@ngrx/effects": "^16.3.0",
"@ngrx/entity": "^16.3.0",
"@ngrx/store": "^16.3.0",
"@ngrx/store-devtools": "^16.3.0",
"@popperjs/core": "^2.11.8",
"@schematics/angular": "^15.2.10",
"@sentry/angular": "^7.79.0",
"@swimlane/ngx-charts": "^20.4.1",
"@sentry/angular": "^7.91.0",
"@swimlane/ngx-charts": "^20.5.0",
"angular-user-idle": "^4.0.0",
"bootstrap": "^5.3.2",
"date-fns": "^2.30.0",
Expand All @@ -58,10 +58,10 @@
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1700.0",
"@angular-devkit/build-angular": "^16.2.10",
"@angular-devkit/core": "^16.2.10",
"@angular-devkit/schematics": "^16.2.10",
"@angular-devkit/architect": "^0.1700.8",
"@angular-devkit/build-angular": "^16.2.11",
"@angular-devkit/core": "^16.2.11",
"@angular-devkit/schematics": "^16.2.11",
"@angular-eslint/builder": "15.2.1",
"@angular-eslint/eslint-plugin": "15.2.1",
"@angular-eslint/eslint-plugin-template": "15.2.1",
Expand All @@ -75,7 +75,7 @@
"@types/google-libphonenumber": "^7.4.30",
"@types/jest": "^29.5.8",
"@types/node": "^20.3.3",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "6.16.0",
"eslint": "^8.53.0",
"eslint-config-standard-with-typescript": "^42.0.0",
Expand All @@ -84,8 +84,8 @@
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.3.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-preset-angular": "^13.1.3",
"lint-staged": "^15.0.0",
"jest-preset-angular": "^13.1.4",
"lint-staged": "^15.2.0",
"ng-lint-staged": "^12.0.4",
"prettier": "2.8.8",
"source-map-explorer": "^2.5.3",
Expand Down
20 changes: 10 additions & 10 deletions packages/portail-admins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@ng-bootstrap/ng-bootstrap": "^14.2.0",
"@popperjs/core": "^2.11.8",
"@sentry/angular": "^7.79.0",
"@sentry/browser": "^7.79.0",
"@sentry/tracing": "^7.79.0",
"@sentry/angular": "^7.91.0",
"@sentry/browser": "^7.91.0",
"@sentry/tracing": "^7.91.0",
"bootstrap": "^5.3.2",
"class-validator": "^0.14.0",
"date-fns": "^2.30.0",
Expand All @@ -47,10 +47,10 @@
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1700.0",
"@angular-devkit/build-angular": "^16.2.10",
"@angular-devkit/core": "^16.2.10",
"@angular-devkit/schematics": "^16.2.10",
"@angular-devkit/architect": "^0.1700.8",
"@angular-devkit/build-angular": "^16.2.11",
"@angular-devkit/core": "^16.2.11",
"@angular-devkit/schematics": "^16.2.11",
"@angular-eslint/builder": "15.2.1",
"@angular-eslint/eslint-plugin": "15.2.1",
"@angular-eslint/eslint-plugin-template": "15.2.1",
Expand All @@ -60,7 +60,7 @@
"@angular/compiler-cli": "^16.2.12",
"@angular/language-service": "^16.2.12",
"@schematics/update": "^0.1102.18",
"@types/d3": "^7.4.1",
"@types/d3": "^7.4.3",
"@types/file-saver": "^2.0.7",
"@types/jest": "^29.5.8",
"@types/node": "^20.3.3",
Expand All @@ -73,8 +73,8 @@
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.3.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-preset-angular": "^13.1.3",
"lint-staged": "^15.0.0",
"jest-preset-angular": "^13.1.4",
"lint-staged": "^15.2.0",
"ng-lint-staged": "^12.0.4",
"prettier": "2.8.8",
"source-map-explorer": "^2.5.3",
Expand Down
14 changes: 7 additions & 7 deletions packages/portail-usagers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@ng-bootstrap/ng-bootstrap": "^14.2.0",
"@popperjs/core": "^2.11.8",
"@sentry/angular": "^7.79.0",
"@sentry/angular": "^7.91.0",
"angular-user-idle": "^4.0.0",
"bootstrap": "^5.3.2",
"date-fns": "^2.30.0",
Expand All @@ -43,10 +43,10 @@
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1700.0",
"@angular-devkit/build-angular": "^16.2.10",
"@angular-devkit/core": "^16.2.10",
"@angular-devkit/schematics": "^16.2.10",
"@angular-devkit/architect": "^0.1700.8",
"@angular-devkit/build-angular": "^16.2.11",
"@angular-devkit/core": "^16.2.11",
"@angular-devkit/schematics": "^16.2.11",
"@angular-eslint/builder": "15.2.1",
"@angular-eslint/eslint-plugin": "15.2.1",
"@angular-eslint/eslint-plugin-template": "15.2.1",
Expand All @@ -67,8 +67,8 @@
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.3.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-preset-angular": "^13.1.3",
"lint-staged": "^15.0.0",
"jest-preset-angular": "^13.1.4",
"lint-staged": "^15.2.0",
"ng-lint-staged": "^12.0.4",
"prettier": "2.8.8",
"source-map-explorer": "^2.5.3",
Expand Down
Loading

0 comments on commit 1ddea6d

Please sign in to comment.