• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 8297833142

15 Mar 2024 02:30PM UTC coverage: 93.589% (-0.02%) from 93.61%
8297833142

Pull #1310

github

fmrsabino
Remove waiting for the Promise result on /events route

- Removes the `await` for the event processing when the `/hooks/events` is triggered.
- This is in line with the status code `202 Accepted` which tells the clients that we accepted the event for processing but will process it asynchronously.
Pull Request #1310: Remove waiting for the Promise result on /events route

1828 of 2188 branches covered (83.55%)

Branch coverage included in aggregate %.

5 of 6 new or added lines in 1 file covered. (83.33%)

6479 of 6688 relevant lines covered (96.88%)

363.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/src/routes/cache-hooks/cache-hooks.controller.ts
1
import {
86✔
2
  Body,
3
  Controller,
4
  HttpCode,
5
  Inject,
6
  Post,
7
  UseGuards,
8
} from '@nestjs/common';
9
import { ApiExcludeController } from '@nestjs/swagger';
86✔
10
import { CacheHooksService } from '@/routes/cache-hooks/cache-hooks.service';
86✔
11
import { ValidationPipe } from '@/validation/pipes/validation.pipe';
86✔
12
import { BasicAuthGuard } from '@/routes/common/auth/basic-auth.guard';
86✔
13
import { Event } from '@/routes/cache-hooks/entities/event.entity';
14
import { PreExecutionLogGuard } from '@/routes/cache-hooks/guards/pre-execution.guard';
86✔
15
import { WebHookSchema } from '@/routes/cache-hooks/entities/schemas/web-hook.schema';
86✔
16
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
86✔
17

18
@Controller({
19
  path: '',
20
  version: '1',
21
})
22
@ApiExcludeController()
23
export class CacheHooksController {
86✔
24
  constructor(
25
    private readonly service: CacheHooksService,
1,168✔
26
    @Inject(LoggingService) private readonly loggingService: ILoggingService,
1,168✔
27
  ) {}
28

29
  @UseGuards(PreExecutionLogGuard, BasicAuthGuard)
30
  @Post('/hooks/events')
31
  @HttpCode(202)
32
  async postEvent(
86✔
33
    @Body(new ValidationPipe(WebHookSchema)) event: Event,
34
  ): Promise<void> {
35
    this.service.onEvent(event).catch((error) => {
94✔
NEW
36
      this.loggingService.error(error);
×
37
    });
38
  }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc