Skip to content

Commit 8803529

Browse files
committed
GetPrintersAsync: Increase timeout
1 parent 9754d7c commit 8803529

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ElectronNET.API/API/ApiBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,19 @@ protected void CallMethod3(object val1, object val2, object val3, [CallerMemberN
116116
}
117117

118118
protected Task<T> InvokeAsync<T>(object arg = null, [CallerMemberName] string callerName = null)
119+
{
120+
return this.InvokeAsyncWithTimeout<T>(InvocationTimeout, arg, callerName);
121+
}
122+
123+
protected Task<T> InvokeAsyncWithTimeout<T>(int invocationTimeout, object arg = null, [CallerMemberName] string callerName = null)
119124
{
120125
Debug.Assert(callerName != null, nameof(callerName) + " != null");
121126

122127
lock (this.objLock)
123128
{
124129
return this.invocators.GetOrAdd(callerName, _ =>
125130
{
126-
var getter = new Invocator<T>(this, callerName, InvocationTimeout, arg);
131+
var getter = new Invocator<T>(this, callerName, invocationTimeout, arg);
127132

128133
getter.Task<T>().ContinueWith(_ =>
129134
{

src/ElectronNET.API/API/WebContents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
139139
/// Get system printers.
140140
/// </summary>
141141
/// <returns>printers</returns>
142-
public Task<PrinterInfo[]> GetPrintersAsync() => this.InvokeAsync<PrinterInfo[]>();
142+
public Task<PrinterInfo[]> GetPrintersAsync() => this.InvokeAsyncWithTimeout<PrinterInfo[]>(10_000);
143143

144144
/// <summary>
145145
/// Prints window's web page.

0 commit comments

Comments
 (0)