Skip to content

Commit

Permalink
Bugfix/rdmp 192 connection failed (#1851)
Browse files Browse the repository at this point in the history
* add better async checking

* ignore timeout of 0ms

* tidy up

* add changelog

* add 12 hour timeout

* use latest fansisql

* update timeout

* bump version
  • Loading branch information
JFriel authored Jun 7, 2024
1 parent 37d624b commit 2afcd87
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add ability to update an extraction's cohort from the command line using `SetExtractionConfigurationCohort ExtractionConfiguration:{id} ExtractableCohort:{id}`
- Fix issue with non-default named PostgreSQL Table Info not being checkable
- Improve default timeouts on database lookups


## [8.1.6] - 2024-05-27
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PackageVersion Include="ExcelNumberFormat" Version="1.1.0"/>
<PackageVersion Include="FluentFTP" Version="50.0.1"/>
<PackageVersion Include="HIC.SynthEHR" Version="2.0.0"/>
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.3"/>
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.5"/>
<PackageVersion Include="LibArchive.Net" Version="0.1.5"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public override ExitCodeType Run(IDataLoadJob job, GracefulCancellationToken can
//pass pre load discard
var destination = new SqlBulkInsertDestination(destinationDatabase, destinationTableName,
columnNamesToIgnoreForBulkInsert);

destination.Timeout = 43200; //set max copy to 12 hours
//engine that will move data
_pipeline = new DataFlowPipelineEngine<DataTable>(context, source, destination, job);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SqlBulkInsertDestination : IDataFlowDestination<DataTable>, IPipeli
private readonly List<string> _columnNamesToIgnore;
private string _taskBeingPerformed;

public const int Timeout = 5000;
public int Timeout = 5000;

private IBulkCopy _copy;
private Stopwatch _timer = new();
Expand Down
13 changes: 6 additions & 7 deletions Rdmp.UI/SimpleControls/ServerDatabaseTableSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public ServerDatabaseTableSelector()

#region Async Stuff

private void UpdateTablesListAsync(object sender, DoWorkEventArgs e)
private async void UpdateTablesListAsync(object sender, DoWorkEventArgs e)
{
var builder = (DbConnectionStringBuilder)((object[])e.Argument)[0];
if (!string.IsNullOrWhiteSpace(Timeout) && int.TryParse(Timeout, out var _timeout))
Expand All @@ -132,9 +132,9 @@ private void UpdateTablesListAsync(object sender, DoWorkEventArgs e)
var syntaxHelper = discoveredDatabase.Server.GetQuerySyntaxHelper();
try
{
using var con = discoveredDatabase.Server.GetConnection();
var openTask = con.OpenAsync(_workerRefreshTablesToken.Token);
openTask.Wait(_workerRefreshTablesToken.Token);
await using var con = discoveredDatabase.Server.GetConnection();
await con.OpenAsync(_workerRefreshTablesToken.Token);
//openTask.Wait(_workerRefreshTablesToken.Token);

var result = new List<DiscoveredTable>();

Expand Down Expand Up @@ -177,7 +177,7 @@ private void UpdateTablesAsyncCompleted(object sender, RunWorkerCompletedEventAr
private void UpdateDatabaseListAsync(object sender, DoWorkEventArgs e)
{
var builder = (DbConnectionStringBuilder)((object[])e.Argument)[0];
if (!string.IsNullOrWhiteSpace(Timeout) && int.TryParse(Timeout, out var _timeout))
if (!string.IsNullOrWhiteSpace(Timeout) && int.TryParse(Timeout, out var _timeout) && _timeout > 0)
{
builder["Timeout"] = _timeout;
}
Expand All @@ -190,8 +190,7 @@ private void UpdateDatabaseListAsync(object sender, DoWorkEventArgs e)
_workerRefreshDatabasesToken = new CancellationTokenSource();
try
{
_listDatabasesAsyncResult = _helper.ListDatabasesAsync(builder, _workerRefreshDatabasesToken.Token)
.ToBlockingEnumerable(_workerRefreshDatabasesToken.Token).ToArray();
_listDatabasesAsyncResult = _helper.ListDatabasesAsync(builder, _workerRefreshDatabasesToken.Token).ToBlockingEnumerable(_workerRefreshDatabasesToken.Token).ToArray();
}
catch (OperationCanceledException)
{
Expand Down
2 changes: 1 addition & 1 deletion directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<Version>8.1.7</Version>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>
</Project>

0 comments on commit 2afcd87

Please sign in to comment.