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

safe-global / safe-client-gateway / 7085686543

04 Dec 2023 11:06AM UTC coverage: 89.935% (+0.2%) from 89.734%
7085686543

Pull #895

github

fmrsabino
Add test for unknown recovery transaction
Pull Request #895: Add test for unknown recovery transaction attempt

1412 of 1701 branches covered (0.0%)

Branch coverage included in aggregate %.

45 of 47 new or added lines in 11 files covered. (95.74%)

23 existing lines in 6 files now uncovered.

5272 of 5731 relevant lines covered (91.99%)

152.0 hits per line

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

50.0
/src/datasources/db/postgres-database.shutdown.hook.ts
1
import { Inject, Injectable, OnModuleDestroy } from '@nestjs/common';
62✔
2
import postgres from 'postgres';
62✔
3
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
62✔
4

5
@Injectable()
6
export class PostgresDatabaseShutdownHook implements OnModuleDestroy {
62✔
7
  private static readonly CONNECTION_CLOSE_TIMEOUT_IN_SECONDS = 5;
62✔
8

9
  constructor(
UNCOV
10
    @Inject('DB_INSTANCE') private readonly db: postgres.Sql,
×
UNCOV
11
    @Inject(LoggingService) private readonly loggingService: ILoggingService,
×
12
  ) {}
13

14
  async onModuleDestroy() {
UNCOV
15
    this.loggingService.info('Closing database connection');
×
16
    // Resolves when all queries are finished and the underlying connections are closed
UNCOV
17
    await this.db.end({
×
18
      // Any pending queries will be rejected once the timeout is reached
19
      timeout: PostgresDatabaseShutdownHook.CONNECTION_CLOSE_TIMEOUT_IN_SECONDS,
20
    });
UNCOV
21
    this.loggingService.info('Database connection closed');
×
22
  }
23
}
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