Open jamie-tillman opened 5 years ago
As I have other progress bars running in my scripts, I would prefer the ability to disable this particular progress display with a specific parameter. I realize that may not be appropriate Powershell etiquette, however.
Hi @jamie-tillman - good catch and thanks for raising this. $ProgressPreference
should be supported here. I'll see what is going on and submit a fix this weekend.
I'm having trouble identifying the cause of this. If I place a Write-Verbose -Message ("Progress Preference = $ProgressPreference") -Verbose
right before the call to Invoke-WebRequest in Invoke-CosmosDbRequest
then it does show that the $ProgressPreference
variable is visible to the CosmosDB function.
Can you try setting $global:ProgressPreference = 'SilentlyContinue'
and see if that suppresses it?
This is very strange. I can't recreate it now! I'm using the Azure Emulator and I'm loading documents in a loop, and had noticed the problem only kicked in after several hundred iterations. Perhaps my system at the time I was observing this was being slowed down, which would have caused the WebRequest progress to be shown because of the delay in http response.
I'll try to find a moment to add process loads to my system and see if that slows the response rate down. Or perhaps I could try loading some larger documents.
Aha, my container re-creation script takes more time and did raise the progress display ever so briefly. Your suspicion was correct. Setting $global:ProgressPreference = 'SilentlyContinue'
does work to suppress it. Setting $ProgressPreference
instead does not.
Using the $global
option will actually work fine for my purposes, as I can simply set it and unset it as I perform the New-CosmosDbDocument
calls.
Thanks for that!
When I run CosmosDB cmdlets (specifically the New-CosmosDbDocument cmdlet), there is a flash of a Powershell status bar:
This is pretty likely coming from Invoke-WebRequest calls that are being performed within the wrappings of the CosmosDB module. Unfortunately, I've set
$ProgressPreference
to"SilentlyContinue"
and it still does this. If I run a standard Invoke-WebRequest call instead, it honors the setting. It appears something in the CosmosDB code is disrupting the proper handling of this setting.Tech details: