@@ -40,8 +40,8 @@ std::shared_ptr<pg::detail::ConnectionPool> CreateCleanupPool(
4040 const pg::Dsn& dsn,
4141 engine::TaskProcessor& task_processor,
4242 pg::InitMode init_mode,
43- pg::PoolSettings pool_settings = pg::PoolSettings{ 1 , 1 , 10 } ,
44- pg::CommandControl command_control = pg::CommandControl{std::chrono::milliseconds{ 100 }, std::chrono::seconds{ 1 } }
43+ pg::CommandControl command_control ,
44+ pg::PoolSettings pool_settings = pg::PoolSettings{ 1 , 1 , 10 }
4545) {
4646 return pg::detail::ConnectionPool::Create (
4747 dsn,
@@ -468,7 +468,14 @@ UTEST_P(PostgrePool, CleanupTaskUseBackgroundFlagAffectsInheritedDeadlinePropaga
468468 return ;
469469 }
470470
471- auto background_pool = CreateCleanupPool (GetDsnFromEnv (), GetTaskProcessor (), GetParam ());
471+ // statement_timeout must be shorter than network_timeout so pg_sleep hits
472+ // QueryCancelled (server-side) rather than ConnectionTimeoutError (client).
473+ auto background_pool = CreateCleanupPool (
474+ GetDsnFromEnv (),
475+ GetTaskProcessor (),
476+ GetParam (),
477+ pg::CommandControl{utest::kMaxTestWaitTime , std::chrono::milliseconds{10 }}
478+ );
472479 const auto background_behavior_errors = TriggerCleanupWithExpiredInheritedDeadline (background_pool);
473480 EXPECT_EQ (background_behavior_errors, 0 ) << " Background cleanup task should not inherit expired request deadline" ;
474481}
@@ -852,8 +859,8 @@ UTEST_P(PostgrePool, ConnectionRateLimitThrottlesAfterFailedCleanup) {
852859 GetDsnFromEnv (),
853860 GetTaskProcessor (),
854861 GetParam (),
855- pg::PoolSettings{ 0 , 3 , 10 , 0 , kHugeConnectingIntervalMs },
856- pg::CommandControl{std::chrono::seconds{ 5 }, std::chrono::seconds{ 30 } }
862+ pg::CommandControl{std::chrono::seconds{ 5 }, std::chrono::seconds{ 30 } },
863+ pg::PoolSettings{ 0 , 3 , 10 , 0 , kHugeConnectingIntervalMs }
857864 );
858865
859866 const auto errors_before = pool->GetStatistics ().connection .error_total .Load ();
0 commit comments