mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
getPrinters: Increase timeout
This commit is contained in:
@@ -116,6 +116,11 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
return this.InvokeAsyncWithTimeout<T>(InvocationTimeout, arg, callerName);
|
||||
}
|
||||
|
||||
protected Task<T> InvokeAsyncWithTimeout<T>(int invocationTimeout, object arg = null, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
|
||||
@@ -123,7 +128,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
return this.invocators.GetOrAdd(callerName, _ =>
|
||||
{
|
||||
var getter = new Invocator<T>(this, callerName, InvocationTimeout, arg);
|
||||
var getter = new Invocator<T>(this, callerName, invocationTimeout, arg);
|
||||
|
||||
getter.Task<T>().ContinueWith(_ =>
|
||||
{
|
||||
@@ -301,7 +306,7 @@ namespace ElectronNET.API
|
||||
_ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName);
|
||||
}
|
||||
|
||||
System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ =>
|
||||
System.Threading.Tasks.Task.Delay(timeoutMs).ContinueWith(_ =>
|
||||
{
|
||||
if (this.tcs != null)
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ public class WebContents : ApiBase
|
||||
/// Get system printers.
|
||||
/// </summary>
|
||||
/// <returns>printers</returns>
|
||||
public Task<PrinterInfo[]> GetPrintersAsync() => this.InvokeAsync<PrinterInfo[]>();
|
||||
public Task<PrinterInfo[]> GetPrintersAsync() => this.InvokeAsyncWithTimeout<PrinterInfo[]>(5_000);
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page.
|
||||
|
||||
Reference in New Issue
Block a user