vapor / postgres-nio

🐘 Non-blocking, event-driven Swift client for PostgreSQL.
https://api.vapor.codes/postgresnio/documentation/postgresnio/
MIT License
317 stars 72 forks source link

Use EventLoop provided by SwiftNIO's MultiThreadedEventLoopGroup.singleton #389

Closed tkrajacic closed 1 year ago

tkrajacic commented 1 year ago

Since SwiftNIO provides a global EventLoopGroup singleton, you can now create a PostgresConnection without explicitly providing an EventLoop. In such a case, an eventLoop from this singleton will be used.

// Uses the MultiThreadedEventLoopGroup.singleton.any() eventLoop
let connection = try await PostgresConnection.connect(
  configuration: config,
  id: 1,
  logger: logger
)

Fixes #388

codecov-commenter commented 1 year ago

Codecov Report

Merging #389 (352965b) into main (220eb50) will decrease coverage by 0.04%. Report is 1 commits behind head on main. The diff coverage is 0.00%.

:exclamation: Current head 352965b differs from pull request most recent head 6eba762. Consider uploading reports for the commit 6eba762 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #389 +/- ## ========================================== - Coverage 46.02% 45.98% -0.04% ========================================== Files 110 110 Lines 8833 8840 +7 ========================================== Hits 4065 4065 - Misses 4768 4775 +7 ``` | [Files Changed](https://app.codecov.io/gh/vapor/postgres-nio/pull/389?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor) | Coverage Δ | | |---|---|---| | [...es/PostgresNIO/Connection/PostgresConnection.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/389?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9Db25uZWN0aW9uL1Bvc3RncmVzQ29ubmVjdGlvbi5zd2lmdA==) | `34.87% <0.00%> (-0.68%)` | :arrow_down: |