Add a delay to avoid race condition for generate script to new Azure db (#1629)

This commit is contained in:
Kim Santiago
2022-08-11 17:24:49 -07:00
committed by GitHub
parent 007e852f1a
commit dd986ee84c

View File

@@ -3,6 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.IO;
using System.Threading;
using Microsoft.SqlServer.Dac;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
@@ -51,6 +52,9 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, Result.DatabaseScript);
if (!string.IsNullOrEmpty(this.Result.MasterDbScript))
{
// Delay to avoid race condition to ensure both scripts get opened in ADS. Fix for https://github.com/microsoft/azuredatastudio/issues/20133
Thread.Sleep(500);
// master script is only used if the target is Azure SQL db and the script contains all operations that must be done against the master database
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, this.Result.MasterDbScript);
}