-
Notifications
You must be signed in to change notification settings - Fork 53
Avoid invoking run.ps1
and port helper module to C# to improve throughput performance
#214
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
Changes from all commits
e114f90
71a7cad
ca561fe
3ba3783
2d4cc7a
a80acfd
4d44920
02cf57d
c513e36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,9 @@ namespace Microsoft.Azure.Functions.PowerShellWorker | |
/// <summary> | ||
/// FunctionLoader holds metadata of functions. | ||
/// </summary> | ||
internal class FunctionLoader | ||
internal static class FunctionLoader | ||
{ | ||
private readonly Dictionary<string, AzFunctionInfo> _loadedFunctions = new Dictionary<string, AzFunctionInfo>(); | ||
private static readonly Dictionary<string, AzFunctionInfo> LoadedFunctions = new Dictionary<string, AzFunctionInfo>(); | ||
|
||
internal static string FunctionAppRootPath { get; private set; } | ||
internal static string FunctionAppProfilePath { get; private set; } | ||
|
@@ -26,9 +26,9 @@ internal class FunctionLoader | |
/// <summary> | ||
/// Query for function metadata can happen in parallel. | ||
/// </summary> | ||
internal AzFunctionInfo GetFunctionInfo(string functionId) | ||
internal static AzFunctionInfo GetFunctionInfo(string functionId) | ||
{ | ||
if (_loadedFunctions.TryGetValue(functionId, out AzFunctionInfo funcInfo)) | ||
if (LoadedFunctions.TryGetValue(functionId, out AzFunctionInfo funcInfo)) | ||
{ | ||
return funcInfo; | ||
} | ||
|
@@ -40,9 +40,25 @@ internal AzFunctionInfo GetFunctionInfo(string functionId) | |
/// This method runs once per 'FunctionLoadRequest' during the code start of the worker. | ||
/// It will always run synchronously because we process 'FunctionLoadRequest' synchronously. | ||
/// </summary> | ||
internal void LoadFunction(FunctionLoadRequest request) | ||
internal static void LoadFunction(FunctionLoadRequest request) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not use static. In future, functions host will move to a model where language worker process does not restart with file changes, FunctionLoader needs to handle lifetime of loaded functions - unload when host sends FileChangeEventRequest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will be a non-trivial refactoring. Can you please open an issue describing what worker is supposed to do when receiving There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the requirement is simply reset the worker, then we already have |
||
_loadedFunctions.Add(request.FunctionId, new AzFunctionInfo(request.Metadata)); | ||
LoadedFunctions.Add(request.FunctionId, new AzFunctionInfo(request.Metadata)); | ||
} | ||
|
||
/// <summary> | ||
/// Get all loaded functions. | ||
/// </summary> | ||
internal static IEnumerable<AzFunctionInfo> GetLoadedFunctions() | ||
{ | ||
return LoadedFunctions.Values; | ||
} | ||
|
||
/// <summary> | ||
/// Clear all loaded functions. | ||
/// </summary> | ||
internal static void ClearLoadedFunctions() | ||
{ | ||
LoadedFunctions.Clear(); | ||
} | ||
|
||
/// <summary> | ||
|
Uh oh!
There was an error while loading. Please reload this page.