diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/InterceptSurvey.ps1 b/tools/Az.Tools.Predictor/Az.Tools.Predictor/InterceptSurvey.ps1 index 0ea178a93438..c6eaa8e2c31b 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/InterceptSurvey.ps1 +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/InterceptSurvey.ps1 @@ -22,6 +22,7 @@ $mutexTiimeout = 1000 $interceptDays = 30 $interceptLoadTimes = 3 $today = Get-Date +$mutexTimeout = 500 function ConvertTo-String { param ( @@ -120,7 +121,12 @@ function Update-InterceptObject { $mutex = New-Object System.Threading.Mutex($false, $mutexName) -$mutex.WaitOne($mutexTimeout) +$hasMutex = $mutex.WaitOne($mutexTimeout) + +if (-not $hasMutex) { + return +} + $shouldIntercept = $false try @@ -157,7 +163,7 @@ if ($shouldIntercept) { if ($userId -ne $null) { $surveyId = Get-Random -Maximum 1000000 -SetSeed $userId.GetHashCode() - Write-Host "We are listening, please share your feedback about Az Predictor: http://aka.ms/azpredictorsurvey?iQ_CHL=intercept&surveyId=$surveyId" + Write-Host "We are listening, please share your feedback about Az Predictor: http://aka.ms/azpredictorsurvey?SessionId=$surveyId" -ForegroundColor $Host.PrivateData.ErrorForegroundColor -BackgroundColor $Host.PrivateData.ErrorBackgroundColor try { $azPredictorSettingFilePath = Join-Path -Path (Join-Path -Path $env:USERPROFILE -ChildPath ".Azure") -ChildPath "AzPredictorSettings.json" @@ -168,7 +174,7 @@ if ($shouldIntercept) { if (Test-Path $azPredictorSettingFilePath) { try { $setting = Get-Content $azPredictorSettingFilePath | Out-String | ConvertFrom-Json - $setting | Add-Member -NotePropertyName "surveyId" -NotePropertyValue $surveyId + $setting | Add-Member -NotePropertyName "surveyId" -NotePropertyValue $surveyId -Force } catch { } } @@ -177,6 +183,6 @@ if ($shouldIntercept) { } catch { } } else { - Write-Host "We are listening, please share your feedback about Az Predictor: http://aka.ms/azpredictorsurvey?iQ_CHL=intercept" + Write-Host "We are listening, please share your feedback about Az Predictor: http://aka.ms/azpredictorsurvey?SessionId=000000" -ForegroundColor $Host.PrivateData.ErrorForegroundColor -BackgroundColor $Host.PrivateData.ErrorBackgroundColor } }