Skip to content

Commit 047ae48

Browse files
committed
Increase thread pool min threads.
This may help work around some test timeouts in CI.
1 parent 1fef877 commit 047ae48

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/SideBySide/DatabaseFixture.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
using System;
1+
using System;
2+
#if NETCOREAPP1_1_2
3+
using System.Reflection;
4+
#endif
5+
using System.Threading;
26
using MySql.Data.MySqlClient;
37

48
namespace SideBySide
@@ -7,6 +11,14 @@ public class DatabaseFixture : IDisposable
711
{
812
public DatabaseFixture()
913
{
14+
// increase the number of worker threads to reduce number of spurious failures from threadpool starvation
15+
#if NETCOREAPP1_1_2
16+
// from https://stackoverflow.com/a/42982698
17+
typeof(ThreadPool).GetMethod("SetMinThreads", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { 64, 64 });
18+
#else
19+
ThreadPool.SetMinThreads(64, 64);
20+
#endif
21+
1022
var csb = AppConfig.CreateConnectionStringBuilder();
1123
var connectionString = csb.ConnectionString;
1224
var database = csb.Database;

0 commit comments

Comments
 (0)