Skip to content

Commit

Permalink
Update the link and message color.
Browse files Browse the repository at this point in the history
  • Loading branch information
kceiw committed Feb 8, 2021
1 parent 7b69536 commit 0509595
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools/Az.Tools.Predictor/Az.Tools.Predictor/InterceptSurvey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $mutexTiimeout = 1000
$interceptDays = 30
$interceptLoadTimes = 3
$today = Get-Date
$mutexTimeout = 500

function ConvertTo-String {
param (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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 {
}
}
Expand All @@ -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
}
}

0 comments on commit 0509595

Please sign in to comment.