postgres-nio icon indicating copy to clipboard operation
postgres-nio copied to clipboard

Fix leakage of promises

Open MahdiBM opened this issue 1 year ago β€’ 3 comments

resolves #496

MahdiBM avatar Aug 03 '24 11:08 MahdiBM

Codecov Report

Attention: Patch coverage is 80.50847% with 23 lines in your changes missing coverage. Please review.

Project coverage is 55.17%. Comparing base (9f84290) to head (892ef0b).

Files with missing lines Patch % Lines
...urces/PostgresNIO/New/PostgresChannelHandler.swift 82.55% 15 Missing :warning:
...nection State Machine/ConnectionStateMachine.swift 75.00% 4 Missing :warning:
...w/Connection State Machine/CloseStateMachine.swift 0.00% 2 Missing :warning:
Sources/PostgresNIO/New/NotificationListener.swift 80.00% 1 Missing :warning:
Sources/PostgresNIO/New/PSQLTask.swift 75.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
+ Coverage   55.12%   55.17%   +0.05%     
==========================================
  Files         127      127              
  Lines       10174    10207      +33     
==========================================
+ Hits         5608     5632      +24     
- Misses       4566     4575       +9     
Files with missing lines Coverage Ξ”
...tion State Machine/ExtendedQueryStateMachine.swift 77.17% <100.00%> (+0.06%) :arrow_up:
Sources/PostgresNIO/New/NotificationListener.swift 69.87% <80.00%> (+0.74%) :arrow_up:
Sources/PostgresNIO/New/PSQLTask.swift 75.67% <75.00%> (-1.47%) :arrow_down:
...w/Connection State Machine/CloseStateMachine.swift 0.00% <0.00%> (ΓΈ)
...nection State Machine/ConnectionStateMachine.swift 61.18% <75.00%> (-0.03%) :arrow_down:
...urces/PostgresNIO/New/PostgresChannelHandler.swift 83.72% <82.55%> (+0.04%) :arrow_up:

... and 1 file with indirect coverage changes

codecov[bot] avatar Aug 03 '24 11:08 codecov[bot]

Not sure how exactly add a test for this. something like:

        let options = XCTMeasureOptions.default
        options.iterationCount = 100
        measure(metrics: [XCTMemoryMetric()], options: options) {
            do {
                let conn = try PostgresConnection.test(on: self.eventLoop).wait()
                _ = try conn.query(
                    "SELECT current_setting('application_name')",
                    logger: .psqlNoOpLogger
                ).wait()
                try conn.close().wait()
            } catch {
                XCTFail(String(reflecting: error))
            }
        }

could work but it's too integrated into Xcode.

Looks like a case that needs benchmarking, like with package-benchmark.

MahdiBM avatar Aug 03 '24 12:08 MahdiBM

@fabianfett another round of review please πŸ™‚

MahdiBM avatar Aug 05 '24 22:08 MahdiBM