HomePhabricator
Diffusion Comm 870b3e2e31fe

[server] avoid creating multiple connection pools

Description

[server] avoid creating multiple connection pools

Summary:
Solves problem described in ENG-1682.

When there are multiple dbQuery at one time also multiple loadPool() can run asynchronously, which lead to problem visible at this debug logs:

image.png (380×1 px, 87 KB)

which means we call mysqlPromise.createPool(options) and assign it to pool when there is an already defined connection, as a result, we override the previous one which is not being closed and cause e.g. scripts not exiting.

Also, each spawned worker has a separate pool connection so this fix should work without additional synchronization.

Test Plan: Run script (e.g. rename-user.js since it begins with multiple asynchronous queries) and check if it will exit adequately.

Reviewers: tomek, atul, ashoat

Reviewed By: tomek

Subscribers: ashoat, atul, abosh

Differential Revision: https://phab.comm.dev/D5050

Details

Provenance
kamilAuthored on Sep 5 2022, 7:28 AM
Reviewer
tomek
Differential Revision
D5050: [server] avoid creating multiple connection pools
Parents
rCOMM13f2e1f40883: [services] Tunnelbroker - Update CMakeLists and Cargo build with the CXX…
Branches
Unknown
Tags
Unknown