hunt-database icon indicating copy to clipboard operation
hunt-database copied to clipboard

SQL query in parallel.

Open vinoakash opened this issue 5 years ago • 1 comments

Hi All,

Request your help as the below code is failing when executed in parallel

Program Code

@trusted public auto getconf(immutable string account) 
{
 string result;
 auto account = Array!string("A1","A2",'A3",'A4");
 foreach(i; parallel(account[], 1)) 
      result  = getconf(i);
 }
 return result;

SQL Code

@trusted public auto getconf(immutable string account)
{
 auto con = new GetConnections();
 Statement stmt = con.db.prepare("SELECT username,passwd FROM config WHERE account = :account");
 stmt.setParameter("account", account);
 RowSet awsaccount = stmt.query();
 scope(exit) con.db.close();
 return account;
}

Error

2020-Nov-19 19:23:36.4671909 | 25056 | warning | FuturePromise.get | Timeout for a promise in 10 secs... | /root/.dub/packages/hunt-extra-1.0.6/hunt-extra/source/hunt/concurrency/FuturePromise.d:170
2020-Nov-19 19:23:36.4673074 | 25060 | warning | FuturePromise.get | Timeout for a promise in 10 secs... | /root/.dub/packages/hunt-extra-1.0.6/hunt-extra/source/hunt/concurrency/FuturePromise.d:170
2020-Nov-19 19:23:36.4672478 | 25061 | warning | FuturePromise.get | Timeout for a promise in 10 secs... | /root/.dub/packages/hunt-extra-1.0.6/hunt-extra/source/hunt/concurrency/FuturePromise.d:170
2020-Nov-19 19:23:36.4675667 | 25061 | warning | PoolBase.getConnection | Timeout in 10 secs | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:149
2020-Nov-19 19:23:36.4676192 | 25061 | info | ConnectionPool.logStatus | pool status, size: 1/5, available: 0, waiters: 0, threads: 9 | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/ConnectionPool.d:284
2020-Nov-19 19:23:36.4675651 | 25056 | warning | PoolBase.getConnection | Timeout in 10 secs | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:149
2020-Nov-19 19:23:36.467762 | 25056 | info | ConnectionPool.logStatus | pool status, size: 1/5, available: 0, waiters: 0, threads: 9 | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/ConnectionPool.d:284
2020-Nov-19 19:23:36.4684355 | 25067 | warning | getConnectionAsync.__lambda1 | The promise 1 has been done. So the connection 3 will be returned to the pool. | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:109
2020-Nov-19 19:23:36.4675788 | 25060 | warning | PoolBase.getConnection | Timeout in 10 secs | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:149
2020-Nov-19 19:23:36.4684981 | 25060 | info | ConnectionPool.logStatus | pool status, size: 1/5, available: 1, waiters: 0, threads: 9 | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/ConnectionPool.d:284
2020-Nov-19 19:23:36.4686326 | 25065 | warning | getConnectionAsync.__lambda1 | The promise 1 has been done. So the connection 2 will be returned to the pool. | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:109
2020-Nov-19 19:23:36.4689074 | 25066 | warning | getConnectionAsync.__lambda1 | The promise 1 has been done. So the connection 4 will be returned to the pool. | /root/.dub/packages/hunt-database-2.1.11/hunt-database/source/hunt/database/base/impl/PoolBase.d:109
hunt.Exceptions.TimeoutException@/root/.dub/packages/hunt-extra-1.0.6/hunt-extra/source/hunt/concurrency/FuturePromise.d(171): Timeout in 10 secs

vinoakash avatar Nov 19 '20 19:11 vinoakash

Can you give us the whole demo project for the test?

Heromyth avatar Nov 20 '20 03:11 Heromyth