Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout on "slow" items #149

Open
RaffaeleBianc0 opened this issue Aug 29, 2022 · 2 comments
Open

Timeout on "slow" items #149

RaffaeleBianc0 opened this issue Aug 29, 2022 · 2 comments

Comments

@RaffaeleBianc0
Copy link

Hello,
it happens very often that some items (usually weather, remote IP, and drives - the latter maybe due to Google Drive "G:" drive being evaluated) are slow to update, or don't update at all (when offline).

This leads to overall rendering times like 5-10 seconds or more sometimes.
I tend to Ctrl+C this to go on with my job.

It would be useful to have a general option like "GlobalTimeout = 100" to set the maximum time in milliseconds each item should wait to get info, otherwise WinFetch should simply skip that item and render the next one.

@rashil2000
Copy link
Member

rashil2000 commented Aug 29, 2022

It is somewhat possible, but will require significant changes to how functions are executed in the final printing step, and how their output is collected.

Note to self: https://stackoverflow.com/questions/21176487/adding-a-timeout-to-batch-powershell

@aetonsi
Copy link
Contributor

aetonsi commented Apr 3, 2023

Hi, i'd like to add that a timeout, especially for network ops, would be really useful.
I was having network problems so the web request to wttr.in couldn't go on. I was stuck for a few minutes (literally) before the script went on, resulting in a network error.

[...]
                                    Disk (G:): 11 GiB / 15 GiB [ ■■■■■■■■-- ]
                                    Battery: Charging [ ■■■■■■■■■■ ]
                                    Locale: Italy - Italian (Italy) - English (United States)
									
[... many minutes without printing anything ...]									

 
 Invoke-RestMethod : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
At C:\tools\winfetch\winfetch.ps1:1354 char:14
+             (Invoke-RestMethod wttr.in/?format="%t+-+%C+(%l)").TrimSt …
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: GET, Reques…PowerShell/7.3.3
}:HttpRequestMessage) [Invoke-RestMethod], HttpRequestException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants