Skip to content

Commit c4bece1

Browse files
committed
[RPC]Fix FunctionLoadTimeout (#6935)
1 parent f7316c5 commit c4bece1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal class GrpcWorkerChannel : IRpcWorkerChannel, IDisposable
5959
private IWorkerProcess _rpcWorkerProcess;
6060
private TaskCompletionSource<bool> _reloadTask = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
6161
private TaskCompletionSource<bool> _workerInitTask = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
62-
private TimeSpan functionLoadTimeout = TimeSpan.FromMinutes(10);
62+
private TimeSpan _functionLoadTimeout = TimeSpan.FromMinutes(10);
6363

6464
internal GrpcWorkerChannel(
6565
string workerId,
@@ -259,9 +259,10 @@ public void SendFunctionLoadRequests(ManagedDependencyOptions managedDependencyO
259259
{
260260
if (functionTimeout.HasValue)
261261
{
262-
functionLoadTimeout = functionTimeout.Value > functionLoadTimeout ? functionTimeout.Value : functionLoadTimeout;
262+
_functionLoadTimeout = functionTimeout.Value > _functionLoadTimeout ? functionTimeout.Value : _functionLoadTimeout;
263263
_eventSubscriptions.Add(_inboundWorkerEvents.Where(msg => msg.MessageType == MsgType.FunctionLoadResponse)
264-
.Timeout(functionLoadTimeout)
264+
.Timeout(_functionLoadTimeout)
265+
.Take(_functions.Count())
265266
.Subscribe((msg) => LoadResponse(msg.Message.FunctionLoadResponse), HandleWorkerFunctionLoadError));
266267
}
267268
else

0 commit comments

Comments
 (0)